This page provides links to various API scripts that show how the Sketch Engine can be accessed automatically.
Example – Corpus Architect authentication and JSON
This example will show you how to access the Sketch Engine API through the Corpus Architect (at http://api.sketchengine.co.uk) and get frequencies for a list of CQL queries by the means of JSON (compare to http authenticated version below). When querying our servers (*.sketchengine.co.uk), please run only one query at once and wait 10 seconds before you run another query.
(the java version needs a module for JSON parsing and a non-standard org.apache.commons.httpclient module)
Example in Java (use attached file not-yet-commons-ssl-0.3.11.jar)
Examples – Basic http authentication and JSON
This example demonstrates how to get a list of frequencies from a list of CQL queries. Using the basic http authentication (it is common for local installations but not compatible with the api.sketchengine.co.uk server) and JSON query (compare to the CA auth version above).
The following example presents an easy way how to convert usual structures (dictionaries for Python, Maps for Java) to JSON objects and how to use the obtained JSON objects as a query to Sketch Engine. Available for Java and Python.
This example presents how to connect the Sketch Engine service on your server using Basic http authentication (it will not work for sketchengine.co.uk, CA auth), send a query (in this particular case simple word list query without JSON) and parse the result for JSON syntax. Note that many modules for JSON parsing are available, you do not have to use the one from the examples.
Minimalistic example – no authentication, no JSON parsing
This example shows bare bones of getting results from the Sketch Engine without any authentication or parsing overhead.