Sketch Grammar Explorer
Introduction
Sketch Grammar Explorer is an API wrapper for Sketch Engine, a corpus management software useful for linguistic research. The goal is to build a flexible scaffold for any kind of programmatic work with Sketch Engine and NoSketch Engine.
Installation
Clone SGEX or install it with pip install sgex (main dependencies are pandas pyyaml aiohttp aiofiles).
Get a Sketch Engine API key. Be sure to reference SkE's documentation and schema:
wget https://www.sketchengine.eu/apidoc/openapi.yaml -O .openapi.yaml
Getting started
A quick intro on the API (examples use a local NoSketch Engine server).
Most things are identical for SkE's main server, apart from using credentials and more call types being available. SGEX currently uses the Bonito API, with URLs ending in
/bonito/run.cgi, not newer paths like/search/corp_info.
Package modules
job: the primary module - makes requests and manipulates datacall: classes and methods for API call typesquery: functions to generate/manipulate CQL queriesutil: utility functions
The Job class
Calls are made with the job module, which can also be run as a script. The Job class has a few options:
from sgex.job import Job
j = Job(
# define API calls
infile: str | list | None = None,
params: str | dict | list | None = None,
# set server info
server: str = "local",
default_servers: dict = default_servers,
# supply credentials
api_key: str | None = None,
username: str | None = None,
# manage caching
cache_dir: str = "data",
clear_cache: bool = False,
# run asynchronous requests
thread: bool = False,
# control request throttling
wait_dict: dict = wait_dict,
# make a dry run
dry_run: bool = False,
# change verbosity
verbose: bool = False,
)
j.run()
See the code repository for full documentation.
Metadata
Release files for sgex 0.7.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sgex-0.7.5.tar.gz | 35.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sgex-0.7.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.2 kB
Release files / sgex-0.7.5.tar.gz
| Download URL | sgex-0.7.5.tar.gz |
|---|---|
| Size | 35.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e0025f97fe0116c2cde8eb402a4ecd37a2bf062232fd9110b5d5d23ace149771
|
|
BLAKE2b-256 checksum How to use checksums |
3c283b3aac3b3b4abac0e074608e4322802d9fea0bc970b68cc52e012cd4d69a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / sgex-0.7.5-py3-none-any.whl
| Download URL | sgex-0.7.5-py3-none-any.whl |
|---|---|
| Size | 21.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61896dfc53156daf045cd2f0b7a985e6163127a400bd4992df826ca7f3c444f1
|
|
BLAKE2b-256 checksum How to use checksums |
825d50b14e089770eacfee3d591317a4fb75b70424742beced18d8e30bfe616e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|