Table of Contents
[ Collection: Introduction to CQP ]
[ Introduction to CQP: Section 1 – Section 2 – Section 3 – Section 4 – Section 5 – Section 6 ]
3a. Extending simple queries: Alternative attributes and values
This section introduces an extension to simple queries in CQP: the possibility to search for more than one thing, It presupposes that you have read Section 1 and Section 2.
Alternative values
Often, we want to search for more than one type of expression. For example, we might be interested in differences between the words love and friendship and so we would want our query to return both words. In such cases, we can use parentheses and the pipe symbol |
to specify alternatives (see Typing special characters to find out how to type this symbol); (x|y)
. For example:
[hw="(love|friendship)"]
Enter this query at the prompt and hit the RETURN
key. You will see that the concordance now contains all word forms belonging to the lemmas love and friendship. We can include as many alternatives as we want in a query in this way, Try, for example:
[hw="(love|friendship|indifference|irritation|hate)"]
Of course, we can also include alternatives in queries using other attributes, such as word
or pos
. The following query finds all instances of the word forms lovers and friends:
[word="(lovers|fiends)"%c]
And the following query finds all words tagged either NN1
(for “singular noun”) or NN2
(for “plural noun”):
[pos="(NN1|NN2)"]
Alternative attributes
We can use a very similar notation to query two alternative attribute-value pairs in a single query. For example, you may want to study the conjunctions and, but, or and because; the first three are coordinating conjunctions, tagged CJC
in the BNC. The last one is a subordinating conjunction, tagged CJS
in the BNC. The following query will find all words tagged CJC
and the lemma because:
[pos="CJC" | hw="because"]
Summary and outlook
This section has shown you how to create concordances containing more than one type of expression. Building on this, you can look at the following sections in any order:
- Section 3b: Extending simple queries: Combinations of attributes and values
- Section 3c: Complex Queries
- Section 3d: Metadata
- Section 3e: Regular expressions (basics)
- Section 3f: Working with concordances
- Section 3g: Sorting and sampling
[ Introduction to CQP: Section 1 – Section 2 – Section 3 – Section 4 – Section 5 – Section 6 ]