Concordance - shows the search word or phrase in context.
Changed onThe concordance allows complex criteria for searching the corpus. The queries can combine any data, metadata and annotations found in the corpus.
To make basic concordance its enough to use just corpname and q parameters.
Request
- The document declares no server URL.
- Auth: HTTP basic
Query parameters
Corpus name. To query your own corpus (e.g. username john, corpus mycorpus), use value user/john/mycorpus.
The CQL query. Regexes are supported for lemma, phrase and word types. The iquery supports simplified wildcards (see concordance_query[iquery]). If you decide to use the concordance_query in a json parameter, you do not have to use this parameter.
The query type. You can send it directly or via the json parameter, the results are the same.
Only works when queryselector is set to iqueryrow. Type a word or phrase.
These special wildcards are supported .
Use the asterisk (*) for any number of unspecified characters. Use a question mark (?) for exactly one unspecified character. Use the pipe (|) to include more than one word or phrase. Use two hyphens (--) to find a word which is hyphenated, non-hyphenated or spelt as two separate words.
Only works when queryselector is set to cqlrow. Type the query using the cql query language.
Only works when queryselector is set to lemmarow. Type the lemma. Regex is supported.
Only works when queryselector is set to charrow. Type the characters that the tokens should contain. Regex is supported.
Only works when queryselector is set to wordrow. Type the word form. Regex is supported.
Only works when queryselector is set to phraserow. Type the phrase. Regex is supported.
The name of the subcorpus. The default value empty string refers to the entire corpus. An example for preloaded/bnc2_tt21 can be Written Academic or 1960-1974.
The part of speech of the lemma. The concrete values depend on the corpus. If the corpus contains the lempos attribute and lpos is empty, the result defaults to the most frequent part of speech of the lemma.
The attribute applied to tokens in the query which do not have an attribute specified explicitly as part of the query.
A list of comma-delimited attributes that are returned together with each token. Other examples are:word, lc, lemma, tag etc..
The text type (metadata) for which statistics should be calculated from the concordance. The default is bncdoc.alltyp (all available text types are included). Text types (attributes and there values) differ between corpora). You can find them in the response of corpus_info method in freqttattrs or subcorpattrs keys. Not all of them have attributes to show.
Determines which tokens will be returned with additional attributes defined in attrs. kw will add the attributes to the KWIC only. all will return them with all tokens.
Switches between sentence view and the KWIC view. sen returns complete sentences without trimming them. kwic returns the KWIC view with the query in the centre and some context left and right.
Only used with error-annotated corpora. It determines what should be highlighted. It is set to 'q' for corpora without error annotation. Meaning of individual options:
-
q -> to higlight query result.
-
e -> to higlight errors.
-
c -> to highlight corrections.
-
b -> to highlight both erros and corrections.
Example of such a corpus can be preloaded/enwiki_error_sample_sentences.
A list of comma-delimited structures (=structure tags) that should be included in the result.
The number of the page that should be returned.
The number of lines in the concordance.
The size of the left context in KWIC view. Number of tokens.
The size of the right context in KWIC view. Number of tokens.
(Only for error-annotated corpora.) Determines what should be highlighted. Corr means correction and err means error. An example of such a corpus is preloaded/enwiki_error_sample_sentences.
(Only for error-annotated corpora). Determines which error type to higlight. An example of such a corpus is preloaded/enwiki_error_sample_sentences.
(Only for error-annotated corpora.) An error token to search.
(Only for error-annotated corpora.) A correction token to search.
An optinal way of wraping parameters. It is possible to send all parametres via this parameter only.
The most frequent uses are:
queryselector: To select the query type. Supported options are: cqlrow, iqueryrow, lemmarow, charrow, phraserow, wordrow. For more information see concordance_query parameters.
iquery: Use with iqueryrow.
cql: Use with cqlrow.
lemma: Use with lemmarow.
lpos: The part of speech of the lemma.
qmcase: Sets the attribute to its lowercased version, i.e. the data are extracted from a lowercased version of the corpus. It used for case insensitive analysis. 1 = case sensitive), 0 = lowercased corpus/case insensitive).
char: Use with charrow.
phrase: Use with phraserow.
word: Use with wordrow
name:
pnfilter:
inclkwic:
filfpos:
filtpos:
desc:
q:
{
"concordance_query": [
{
"queryselector": "iqueryrow",
"iquery": "test"
}
]
}Switches the asynchronous processing on/off. ON = partial results are returned as soon as the first page is filled with results. OFF = results are returned only after the search is completed. Normally, ON is used in the web interface and OFF when using the API.
The format of the output. Empty value is interpreted as JSON. Not every endpoint supports all formats.
Response
OK
Example response
{
"Lines": [
{
"toknum": 10336,
"hitlen": 1,
"Refs": [
"Written books and periodicals"
],
"Tbl_refs": [
"Written books and periodicals"
],
"Left": [
{
"strc": "<s>"
}
],
"Kwic": [
{
"str": "dogs",
"coll": 1
}
],
"Right": [
{
"str": "</s>"
}
],
"linegroup": "_"
}
],
"fromp": 1,
"concsize": 12087,
"concordance_size_limit": 10000,
"finished": 1,
"fullsize": 12087,
"relsize": 107.59,
"q": [
"q[lc=\\\"dog\\\" | lemma_lc=\\\"dog\\\"]"
],
"Desc": {
"op": "Query",
"arg": "[lc=\\\"dog\\\" | lemma_lc=\\\"dog\\\"]",
"nicearg": "dog",
"rel": 107.59,
"size": 12087,
"tourl": "q=q%5Blc%3D%22dog%22+%7C+lemma_lc%3D%22dog%22%5D"
},
"sc_strcts": [
[
"bncdoc"
]
],
"api_version": "5.63.1",
"manatee_version": "2.36.7-SkE-2.221",
"request": {
"concordance_query": [
{
"queryselector": "iqueryrow",
"iquery": "dog"
}
],
"corpname": "preloaded/bnc2_tt21",
"kwicleftctx": "100#",
"structs": "s,g",
"viewmode": "sen",
"attr_allpos": "all",
"fromp": "1",
"json": "{\\\"concordance_query\\\":[{\\\"queryselector\\\":\\\"iqueryrow\\\",\\\"iquery\\\":\\\"dog\\\"}]}",
"kwicrightctx": "100#",
"refs": "=bncdoc.alltyp",
"cup_hl": "q",
"attrs": "word",
"pagesize": "20"
}
}Changes
- breaking
the
queryrequest parameterattr_allposwas restricted to a list of enum values - breaking
for the
queryrequest parameterattr_allpos, default valueallwas added - info
added the new enum value
allto thequeryrequest parameterattr_allpos - info
added the new enum value
kwto thequeryrequest parameterattr_allpos
- breaking