===== Lesson 1: Query types =====
If this is your first time working with the KonText corpus manager, you may benefit from reading the general [[https://wiki.korpus.cz/doku.php/en:manualy:kontext:index|KonText manual]] or [[https://wiki.korpus.cz/doku.php/en:kurz:uvod|the course aimed at working with the EEBO corpus]].
After successfully completing the online registration and logging into KonText, you can begin with your first query. Firstly, the corpus you intend to work with needs to be selected; the default corpus in the KonText interface is the //syn2015// corpus. By clicking on the name in the blue box, you can access a list of all the corpora available to you. If you have worked with KonText before, you may find a list of your favourite corpora on the left, while the featured corpora list is located in the right column. To find the OBC, click on //All corpora//, type in the name, ''obc'', into the search box and select the corpus from the dropdown menu. Alternatively, you can use the direct link [[https://www.korpus.cz/kontext/query?corpname=obc|here]].
{{:en:obc:l1_1.png?direct&600|}}
You may then save it as one of your favourite corpora by clicking on the star next to the blue box. Now you can type the first query into the query box.
**Basic information**
To see the basic information about OBC, simply click on the name of the corpus under the KonText logo.
{{:en:obc:l1_2.png?direct&600|}}
What you can learn from this is the total number of positions, and the number of different attributes and structures in the corpus, however this does not provide the full list of metadata available for this corpus.
**First Query**
With the query type set on //Basic//, you can type any word or multiple words into the query line. Then just click on the search button or press the enter key.
Try searching:
- A simple word, such as //innocent//.
- Names of the British rulers of the period – try searching for //George III// and //George the third//.
- Punctuation marks, such as //!//, //?//, or //;//.
- Some words which were coined in the 18th and 19th centuries, e.g. //growl//, //descriptive//, and //cab//.
After clicking on the search button (or pressing the enter key), you will be presented with the [[https://wiki.korpus.cz/doku.php/en:pojmy:konkordance|concordance]] list.
{{:en:obc:l1_3.png?direct&800|}}
The searched word or phrase appears in pink and is called [[https://wiki.korpus.cz/doku.php/en:pojmy:kwic|KWIC (key word in context)]]. The whole line is called concordance line and is part of the concordance (i.e. all of the occurrences of the searched phenomenon in given corpus, along with their surrounding text).
To check if the search worked correctly, compare the following numbers with your results:
|**Query** |**Number of hits**|**Relative frequency (i.p.m.)**|
|//innocent// |2572 |72.58 |
|//George III//|9 |0.25 |
|//!// |6650 |187.66 |
|//growl// |2 |0.06 |
It should be noted here that the absolute [[https://wiki.korpus.cz/doku.php/en:pojmy:frekvence|frequency]] of the given word (i.e. number of hits) requires further clarification: the size of the corpus or the absolute frequency of another word for comparison. The value of the relative frequency (i.e. absolute frequency in proportion to the total size of the corpus) indicates the number of times the given word occurs in a million words (i.p.m. = instances per million), and thus makes it possible to compare data from corpora of differing sizes. The OBC has approximately 35.5 million positions, hence the relative frequency of the word //innocent//, which occurs 2,572 times in the corpus, is 72.58.
For basic statistical tasks (e.g. comparing frequencies in corpora of different sizes), you might find useful the corpus calculator [[https://korpus.cz/calc/|Calc]].
**New Query**
To start a new search in KonText, click on the item //Query → New Query// located in the top menu, or simply click on the KonText logo in the top left corner.
**Query Types**
There are five query types offered for the OBC: basic, phrase, word form, word part, and CQL. Since the OBC is not lemmatized, there is no option to search for lemmas. Each query type is best suitable for different kind of research.
**Query Type: Basic**
Basic query is often used to familiarize oneself with the given corpus. It is ideal for elementary searches which do not require great accuracy. As the OBC is not lemmatized, basic query searches only for the word forms which match the query perfectly. The search is case-insensitive and does not support regular expressions.
**Query Type: Word Form**
Word form, or node form, query is used for the analysis of one specific form of a word, as it finds only the forms which match the query exactly. By default, it is case-insensitive; try searching the word //prisoner// – in the concordance, you will find //prisoner//, //Prisoner//, but also //PRISONER//. If you wish to make the search case-sensitive, tick the box //Match case//. If you now enter ''Grace'' with an upper-case G and tick the //Match case// box, the resulting concordance will include only the exact matches, hence excluding //grace// with lower-case G. This query type supports regular expressions, hence the difference between the Basic and Word form query types is the possibility to conduct case-sensitive searches and use regular expressions.
**Query type: Phrase**
Phrase query is especially useful, as it allows searching for multiword expressions. It finds the exact wording of the phrase inputted. It supports regular expressions.
Try searching for the phrase //corporal punishment//.
* When the search is case-insensitive (i.e. the //Match case// box is left unticked), you will find the following forms: //corporal punishment//, //corporal Punishment//, and //Corporal Punishment//.
* When you tick the box and make the search case-sensitive, you will find only the exact phrase //corporal punishment//, all in lower-case letters.
**Query Type: Word Part**
If you wish to find all words containing a particular string of consecutive characters, preceded and followed by any number of other characters (or none), the most suitable query type for this task is the Word Part (Character) query. It supports regular expressions and is case-sensitive, therefore searching for //wise// and //Wise// will yield different results.
Try searching for all the words that contain the following word parts:
* //hood//
* //blood//
* //counter//
To see all the words containing the particular word part, you may go through the concordance manually, however the easiest way to get an overview of all the words is to click on the //Frequency// button located at the upper part of the page and then select //Node forms// from the dropdown menu. A list of all the words containing the particular string of characters arranged according to their absolute frequency will appear.
{{:en:obc:l1_4.png?direct&600|}}
**Query Type: CQL**
All the query types mentioned above are internally converted into [[https://wiki.korpus.cz/doku.php/en:pojmy:dotazovaci_jazyk|CQL (Corpus Query Language)]], it is therefore the most universal query type in the KonText interface. Its cornerstone is a query for a single position (word) in the corpus: [attribute=”value”] where the attribute is positional (word, lemma, tag etc.), the value is the search term itself, or a pattern specified with the help of regular expressions. However, we will focus on CQL in more advanced stages of the course.
----
**If you are ready, you can continue to [[en:obc:spelling|Lesson 2]].**
----