cqp:concordances
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
cqp:concordances [2020/04/19 14:35] – created astefanowitsch | cqp:concordances [2024/06/20 13:53] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | **[ [[cqp: | ||
+ | ====== 3f. Working with concordances ====== | ||
+ | |||
+ | //This section looks in more detail at concordances and discusses some useful ways of making them fit your needs. It also discusses how a concordance can be saved to an external file. This section presupposes that you have read [[cqp: | ||
+ | |||
+ | ===== Context size and context type ===== | ||
+ | |||
+ | As discussed in [[cqp: | ||
+ | |||
+ | set Context 50 | ||
+ | |||
+ | If we now produce a concordance, | ||
+ | |||
+ | We can also set a different context size for the left context and the right context, using the commands '' | ||
+ | |||
+ | set LeftContext 10 | ||
+ | set RightContext 40 | ||
+ | |||
+ | If we now create a concordance, | ||
+ | |||
+ | Instead of specifying a certain number of characters, we can also specify a certain number of words. For example, to set the context to ten words to the left and right, we type: | ||
+ | |||
+ | set Context 10 words | ||
+ | |||
+ | However, KWIC concordances are just one type of concordance. Instead, we may want to have one or more whole sentences or even paragraphs displayed. In corpora that have metadata tags (see [[cqp: | ||
+ | |||
+ | set Context s | ||
+ | |||
+ | If we want an additional sentence before and after the one containing the match, we type the following, and so on: | ||
+ | |||
+ | set Context 2 s | ||
+ | |||
+ | If we want a whole paragraph displayed for every match, we type the following: | ||
+ | |||
+ | set Context p | ||
+ | |||
+ | These settings are set back to the default of 30 characters to either side when you quit CQP. | ||
+ | |||
+ | ===== Displaying linguistic annotation ===== | ||
+ | |||
+ | By default, a concordance will always display the contents of the '' | ||
+ | |||
+ | show +pos | ||
+ | |||
+ | Try it, you will see that for each word in the concordance line, its '' | ||
+ | |||
+ | show -pos | ||
+ | |||
+ | ===== Storing concordances internally ===== | ||
+ | |||
+ | When we create a concordance, | ||
+ | |||
+ | This is useful if we have created a complex query that takes some time to run and then realize that we want to change the display settings as described above. Instead of re-running the query, we can simply change the display settings as desired and then use the command '' | ||
+ | |||
+ | [hw=" | ||
+ | set Context s | ||
+ | cat Last | ||
+ | |||
+ | If you think this is nice, wait for the next bit! Obviously, we may create more than one concordance during a CQP session. Wouldn' | ||
+ | |||
+ | [hw=" | ||
+ | Air = Last | ||
+ | cat Air | ||
+ | |||
+ | (Of course, we can also call the variable //Love// or anything else. The variable name does not have to begin with a capital letter, but it is a useful habit to write variable names in this way, so that you do not confuse them with commands.) | ||
+ | |||
+ | We can also store a concordance in a variable immediately, | ||
+ | |||
+ | Love = [hw=" | ||
+ | |||
+ | If we hit RETURN, no results are displayed, as they have been stored directly in our variable, which we can display by typing '' | ||
+ | |||
+ | These variables are all deleted when you quit CQP. If you want them to be available the next time you use CQP, you have to save them externally (see below). | ||
+ | |||
+ | ===== Combining internally stored concordances ===== | ||
+ | |||
+ | If we have several concordances stored in variables, we can combine them in various ways. Most straightforwardly, | ||
+ | |||
+ | [hw=" | ||
+ | Love = Last | ||
+ | [hw=" | ||
+ | Friendship = Last | ||
+ | |||
+ | …we can combine them into a concordance named GoodRelations as follows: | ||
+ | |||
+ | GoodRelations = union Love Friendship | ||
+ | |||
+ | If you remember set theory from your math lessons, you will recognize that the word //union// is a set-theoretic term, which suggests that we may also perform other set-theoretic operations on named concordances. And we can! In addition to '' | ||
+ | |||
+ | ===== Saving a concordance ===== | ||
+ | |||
+ | There are two ways of saving a concordance to an external file. First, we can save it in a format that is only readable by the Corpus Workbench, so that if we want to look at it again, we have to import it back into the Corpus Workbench. This is useful if we have created a complex concordance and want it to be available in CQP the next time you work with it (remember: all concordances are deleted when you quit CQP). Second -- and this is probably the more typical case -- we can export a concordance to a text file that we can then open with a text editor or spreadsheet program. This is useful if we are satisfied with our concordance and want to keep working with it outside of CQP (for example, in order to add further annotations of our own as part of some research project). | ||
+ | |||
+ | ==== Saving a concordance for the next CQP session ==== | ||
+ | |||
+ | To save a concordance in a way that allows us to re-import it into CQP, we must first tell CQP where to save it. This is done by the command '' | ||
+ | |||
+ | set DataDirectory " | ||
+ | |||
+ | Setting the data directory will make CQP exit our current corpus, so we have to select it again by typing its name and hitting '' | ||
+ | |||
+ | save Love | ||
+ | |||
+ | Next time we start CQP, we have to set the data directory again… | ||
+ | |||
+ | set DataDirectory " | ||
+ | |||
+ | … and we can then work with the concordance as we would work with any concordance stored in a variable, e.g., display it by typing | ||
+ | |||
+ | cat Go; | ||
+ | |||
+ | If we don't remember what we called our concordance, | ||
+ | |||
+ | show named; | ||
+ | |||
+ | ==== Exporting a concordance to an external file ==== | ||
+ | |||
+ | As mentioned earlier, the more typical case is the one where we want to export a concordance to a text file to open it with a text editor or other program. | ||
+ | |||
+ | This is done using the '' | ||
+ | |||
+ | cat Love > " | ||
+ | |||
+ | Now, all you have to do is get the file from your Linux account. There are many ways of doing this, the easiest one is to go to the [[https:// | ||
+ | |||
+ | ===== Summary and outlook ===== | ||
+ | |||
+ | This section has shown you how to manipulate concordances in various ways and how to export them. Building on this, you can look at the following sections in any order: | ||
+ | |||
+ | * [[cqp: | ||
+ | * [[cqp: | ||
+ | * [[cqp: | ||
+ | * [[cqp: | ||
+ | * [[cqp: | ||
+ | * [[cqp: | ||
+ | |||
+ | **[ Introduction to CQP: [[cqp: |