Both sides previous revisionPrevious revisionNext revision | Previous revision |
cqp:extending-queries-combinations [2020/04/21 14:59] – external edit 127.0.0.1 | cqp:extending-queries-combinations [2024/06/20 13:53] (current) – external edit 127.0.0.1 |
---|
| **[ [[cqp:introduction|Collection: Introduction to CQP]] ]** |
| |
| **[ Introduction to CQP: [[cqp:corpus-structure|Section 1]] -- [[cqp:simple-queries|Section 2]] -- [[cqp:advanced-querying|Section 3]] -- [[cqp:beyond-queries|Section 4]] -- [[cqp:expert-tricks|Section 5]] -- [[cqp:exercises|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 [[cqp:corpus-structure|Section 1]] and [[cqp:simple-queries|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 [[cqp:special-characters|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: |
| |
| * [[cqp:extending-queries-alternatives|Section 3b]]: Extending simple queries: Combinations of attributes and values |
| * [[cqp:complex-queries|Section 3c]]: Complex Queries |
| * [[cqp:metadata|Section 3d]]: Metadata |
| * [[cqp:regular-expressions-basics|Section 3e]]: Regular expressions (basics) |
| * [[cqp:concordances|Section 3f]]: Working with concordances |
| * [[cqp:sorting-sampling|Section 3g]]: Sorting and sampling |
| |
| **[ Introduction to CQP: [[cqp:corpus-structure|Section 1]] -- [[cqp:simple-queries|Section 2]] -- [[cqp:advanced-querying|Section 3]] -- [[cqp:beyond-queries|Section 4]] -- [[cqp:expert-tricks|Section 5]] -- [[cqp:exercises|Section 6]] ]** |