API Two dimensional freq distribution - czcorpus/kontext GitHub Wiki

HTTP API / Two-dimensional frequency distribution

Request

  • URL: /freqct
  • HTTP Method: GET

URL Query arguments

name description
q concordance persistence ID; the value must have a ~ prefix to distinct fully stored queries from legacy/NoSkE ones
ctfcrit1 the 1st dimension criterion containing both attribute and search range (e.g. lemma 0<0); both positional and structural attributes are supported
ctfcrit2 the 2nd dimension criterion
ctminfreq a minimum frequency of included entries; the units are defined by the ctminfreq_type parameter
ctminfreq_type abs - absolute freq., pabs - percentile of abs. freq., ipm - instances per million, pipm - percentile of ipm

Response

  • HTTP status: 200 OK (if without errors)
  • content type: application/json
name (path) description
freq_type 2-attribute (this is a constant used by KonText's web interface)
attr1 matches the attribute part of ctfcrit1 given in the request (e.g. lemma in case of ctfcrit1=lemma 0<0)
attr2 matches the attribute part of ctfcrit2 given in the request
data.data[i][0] matching 1st dimension value
data.data[i][1] matching 2nd dimension value
data.data[i][2] absolute frequency
data.data[i][3] base set size for i.p.m. calculation *️⃣

*️⃣ More information about base set size:

  1. in case of a relationship between two structural attributes, the value is always 1000000 which should be interpreted as not applicable
  2. in case of two positional attributes, the base set size equals size of a respective concordance
  3. in case of one positional and one structural attribute, the base set size is a number of tokens in a subcorpus specified by a respective structural attribute value (i.e. not affected by a respective concordance)

Example (you must be logged-in to KonText):

https://www.korpus.cz/kontext-api/v0.17/freqct?q=~vMSCwEgqqSOu&ctfcrit1=lemma_lc%200<0&ctfcrit2=doc.txtype_group%200&ctminfreq=80&ctminfreq_type=pabs&format=json