Skip to main content

Sketch Grammar Explorer (Sketch Engine API wrapper)

Project description

Sketch Grammar Explorer

PyPI Latest Release PyPI - Python Versions Package Status License DOI

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.

UPDATE

SGEX 0.7.0+ is another redesign of the package meant to facilitate enhancements. The workflow is improved and it's streamlined for adapting to SkE's updated API schema. Old methods are deprecated and unavailable in new releases.

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 data
  • call: classes and methods for API call types
  • query: functions to generate/manipulate CQL queries
  • util: 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sgex-0.7.3.tar.gz (32.5 kB view details)

Uploaded Source

Built Distribution

sgex-0.7.3-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file sgex-0.7.3.tar.gz.

File metadata

  • Download URL: sgex-0.7.3.tar.gz
  • Upload date:
  • Size: 32.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for sgex-0.7.3.tar.gz
Algorithm Hash digest
SHA256 b23ffcf971b817461a1bce3848915a85dc2b481048b0f1be3e8c465ceaedc230
MD5 6e3d938db7613ff75b171e6fd8500f50
BLAKE2b-256 c8a88b558cdd33afba3eb928e452ae475628acf8e548029b51f2af20495af678

See more details on using hashes here.

File details

Details for the file sgex-0.7.3-py3-none-any.whl.

File metadata

  • Download URL: sgex-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for sgex-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 98cfc0a0255126e468cc2afead1cfe37a41f895f346dde9f832a8acfea11a762
MD5 5adebdebda737dd893cfe61d9259e670
BLAKE2b-256 6131a54a9893e73d960a6e5675e9074b25435e68c7ff3d9d1883700e6e26d01e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page