cqp:complex-queries
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
cqp:complex-queries [2020/04/21 14:59] – external edit 127.0.0.1 | cqp:complex-queries [2024/06/20 13:53] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | **[ [[cqp: | ||
+ | ====== 3c. Complex Queries ====== | ||
+ | |||
+ | //This section introduces complex queries, i.e., queries for sequences of tokens rather than just a single token. It presupposes that you have read [[cqp: | ||
+ | |||
+ | ===== Sequences of value-attribute pairs ===== | ||
+ | |||
+ | So far, we have only looked at queries involving a single token -- we looked for //love//, for nouns, etc. Corpus linguistic investigations often start from individual words, so such queries are very typical. However, there are many research questions that involve multi-word expressions, | ||
+ | |||
+ | For example, we might want to search for //true love// only. The query for this would look as follows (note the '' | ||
+ | |||
+ | [word=" | ||
+ | |||
+ | Enter this query at the prompt and hit '' | ||
+ | |||
+ | Or, we might feel nostalgic and want to search for //lost love//. The query would look like this: | ||
+ | |||
+ | [word=" | ||
+ | |||
+ | Of course, we can construct sequences where we are using different attributes at different positions. For example, we might be interested in all the different types of love in the corpus, i.e., all sequences of an adjective and the word //love//. The query would look like this ('' | ||
+ | |||
+ | [pos=" | ||
+ | |||
+ | Run this query and look at the result. Your concordance will now contain all such sequences, for example, // | ||
+ | |||
+ | ===== Excluding elements from sequences ===== | ||
+ | |||
+ | Recall from [[cqp: | ||
+ | |||
+ | [pos=" | ||
+ | |||
+ | (Strictly speaking, this only excludes nouns in the singular, you can use the notation with the parentheses and the pipe symbol described in [[cqp: | ||
+ | |||
+ | ===== Sequences with gaps ===== | ||
+ | |||
+ | Of course, linguistic structures are often more complex than a simple sequence of tokens -- they may contain optional, variable positions (for example, a noun phrase consists of an optional determiner, optionally followed by one or more adjectives, followed by a noun (or, in the case of compounds, a sequence of nouns). CQP allows us to construct queries that take this optionality into account. | ||
+ | |||
+ | Let us use a simpler example than that of a noun phrase. Let us say that we are interested in //falling in love// -- the fixed expression, not the event denoted by it. We could construct the following query: | ||
+ | |||
+ | [hw=" | ||
+ | |||
+ | However, this will only find cases where the three words occur in an uninterrupted sequence (try it). It is possible, that an adverb occurs between //fall// and //in// –– as in the line //I fell so hard in love with you// from the song //Just one look// by the great Doris Troy. We can adjust our query to take this into account by simply inserting an empty pair of square brackets in the appropriate position: | ||
+ | |||
+ | [hw=" | ||
+ | |||
+ | This empty pair of brackets means “any token”. If you run this query, you will find sequences like //fall completely in love//, //fall passionately in love//, //fall hopelessly in love//, and so on. | ||
+ | |||
+ | However, this does not solve our problem yet, because now the query only finds cases where something occurs between //fall// and //in// -- it does not take into account, that this is // | ||
+ | |||
+ | [hw=" | ||
+ | |||
+ | Try the query, you will see that it now includes sequences with and without an adverb (you will have to scroll down a little bit before you see the first case of an adverb). | ||
+ | |||
+ | In the line from the song I just cited, there are actually two elements between //fall// and //in//. We could take this into account by adjusting the relevant part of the query to '' | ||
+ | |||
+ | [hw=" | ||
+ | |||
+ | You will find that there are a few such cases in the BNC. | ||
+ | |||
+ | ===== Summary and outlook ===== | ||
+ | |||
+ | This section has shown you how to create concordances using complex queries. Building on this, you can look at the following sections in any order: | ||
+ | |||
+ | * [[cqp: | ||
+ | * [[cqp: | ||
+ | * [[cqp: | ||
+ | * [[cqp: | ||
+ | * [[cqp: | ||
+ | * [[cqp: | ||
+ | |||
+ | **[ Introduction to CQP: [[cqp: |