Corpus Search

Get a list of subcorpora in the corpus or create/delete a subcorpus.

Changed on

There is two option how to create subcorpora in Sketch Engine from text types => json parameter (corpus must be annotated for text types) or from concordances => q + struct parameters.

get/search/subcorp

Request

  • The document declares no server URL.
  • Auth: HTTP basic

Query parameters

corpnamestring required

Corpus name. To query your own corpus (e.g. username john, corpus mycorpus), use value user/john/mycorpus.

subcnamestring required

Name of the subcorpus.

create0 | 1

Set to 1 if new subcorpus should be created. Subcorpus will not be created if left empty (default value == 0).

delete0 | 1

Set to 1 if the corpus should be deleted. Only user subcorpora can be deleted. Nothing will be deleted if left empty (default value == 0).

qstring
Example:q=alemma,[lc="test" | lemma_lc="test"]

Query for creating subcorpora from concordance.

The search criteria are specified within brackets following a prefix like alemma or aword. This prefix often indicates the type of linguistic search (e.g., lemma-based, word-based). The criteria within the brackets can include checks for specific words, lemmas, parts of speech and more, using operators like | (OR), & (AND), and regular expressions.

The lists of available attributes, pos tags for specific corpus can be obtained via /search/corp_info.

Examples:

  • Simple word or lemma search in the BNC corpus:

    q=alemma,[lc="test" | lemma_lc="test"]

  • Search for nouns with the lemma 'test' in a case-sensitive manner:

    q=alemma,[lempos_lc="(test)-n"]

  • Search for verbs with the lemma 'test', case-insensitive:

    q=alemma,[lempos="(test)-v"]

  • Searching for a specific phrase 'test' in a case-sensitive manner:

    q=aword,[word="test"]

  • Searching for the numeral '1955':

    q=alemma,[word="1955" & tag="CD"]

  • Regex-based search for words containing the character 'h':

    q=alemma,[word=".*h.*"]

  • Complex search involving the lemma 'book' followed by up to three words, then a verb:

    q=alemma,[lemma="book"][]{1,3}[tag="V.*"]

structstring
Example:doc

Which corpus structure should be used in new subcorpus. Used withim concordance type of subcorpus. The lists of structures can be obtained via /search/corp_info.

jsonobject

Used to specify text types for a subcorpus. Takes a JSON object as input, where the key-value pairs define the specific attributes. The attributes can vary depending on the corpus.

When using the json parameter in a query, you can define a JSON object with one or more attributes. Each attribute can have a single value or an array of values.

The list of available text types for specific corpus can be obtained via /search/corp_info just add sca_ in front the name (see examples).

Examples:

  • To create a subcorpus based on a specific spoken text type from the BNC corpus:

    {"sca_bncdoc.alltyp":["Spoken context-governed"]}

  • To filter texts from the BNC corpus that are both spoken context-governed and spoken demographic:

    {"sca_bncdoc.alltyp":["Spoken context-governed","Spoken demographic"]}

  • To select texts from the BNC corpus from a specific time period (1960-1974):

    {"sca_bncdoc.alltim":["1960-1974"]}

  • To create a subcorpus with texts from specific authors and time periods, along with regional specifications:

    {"sca_bncdoc.author": ["Author1","Author2",...],"sca_bncdoc.alltim": ["1985-1993","1975-1984"], "sca_bncdoc.wripp": ["UK (unspecific)","Ireland"]}

  • To filter texts from the Ententen corpus based on domain and topic:

    {"sca_doc.tld":["org","com"], "sca_doc.topic": ["arts","beauty & fashion","cars & bikes","culture & entertainment"]}

  • For a user-specific corpus, filtering based on document ID and filename:

    {"sca_doc.id":["file29173711"],"sca_doc.filename":["Filename.pdf"]}

{
  "sca_bncdoc.alltyp": [
    "Spoken context-governed"
  ]
}
format'json' | 'xml' | 'csv' | 'tsv' | 'txt' | 'xls'

The format of the output. Empty value is interpreted as JSON. Not every endpoint supports all formats.

Response

OK

subcnamestring
api_versionstring
manatee_versionstring

Example response

{
  "subcname": "Australian domain .au",
  "SubcorpList": [
    {
      "n": "Australian domain .au",
      "name": "Australian domain .au"
    }
  ],
  "api_version": "5.63.1",
  "manatee_version": "2.36.7-SkE-2.221",
  "request": {
    "corpname": "preloaded/ententen13_tt2_1"
  }
}

Changes

    • breaking

      added the new required query request parameter subcname

    • breaking

      the query request parameter delete was restricted to a list of enum values

    • breaking

      for the query request parameter delete, default value 0 was added

    • breaking

      for the query request parameter delete, the type changed from string to integer

    • info

      added the new optional query request parameter create

    • info

      added the new optional query request parameter format

    • info

      added the new optional query request parameter json

    • info

      added the new optional query request parameter q

    • info

      added the new optional query request parameter struct

    • info

      added the new enum value 0.00 to the query request parameter delete

    • info

      added the new enum value 1.00 to the query request parameter delete