Sketch Engine API Documentation
Examples
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://beta.sketchengine.co.uk) and get frequencies for a list of CQL queries by the means of JSON (compare to http authenticated version below).
(the java version needs a module for JSON parsing and a non-standard org.apache.commons.httpclient module)
Example in Java (view full source)
Example in Python (view full source)
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 beta.sketchengine.co.uk server) and JSON query (compare to the CA auth version above).
Example3 in Java (view full source)
Example3 in Python (view full source)
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.
Example2 in Java (view full source)
Example2 in Python (view full source)
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.
Example1 in Java (view full source)
Example1 in Python (view full source)
Minimalistic example - no authentication, no JSON parsing
This exampe shows bare bones of getting results from the Sketch Engine without any authentication or parsing overhead.
Example in Java (view full source)
Example in Python (view full source)
Attachments
-
example3_ca.java
(3.5 KB) -
added by xkovar3 4 months ago.
-
example3_ca.py
(1.5 KB) -
added by xkovar3 4 months ago.
-
example3.java
(2.6 KB) -
added by husak 3 months ago.
-
example3.py
(1.2 KB) -
added by husak 3 months ago.
-
example1.py
(699 bytes) -
added by husak 3 months ago.
-
example2.py
(955 bytes) -
added by husak 3 months ago.
-
example2.java
(2.1 KB) -
added by husak 3 months ago.
-
example1.java
(1.7 KB) -
added by husak 3 months ago.
