CQi SDK for Python
A Python library for the IMS Open Corpus Workbench (CWB) Corpus Query Interface (CQi) API.
Installation
The latest stable version is available on PyPI. Either add cqi
to your requirements.txt
file or install with pip:
pip install cqi
Version compatibility
Package version | Protocol version |
---|---|
0.1.0 - 0.1.7 | 0.1 |
Usage
import cqi
client = cqi.CQiClient('127.0.0.1')
client.connect(username='anonymous', password='') # <class 'cqi.status.StatusConnectOk'>
client.ping() # <class 'cqi.status.StatusPingOk'>
corpus = client.corpora.get('CORPUS') # <Corpus: CORPUS>
corpus.query('"and" []* "the";', 'Results') # <class 'cqi.status.StatusOk'>
results = corpus.subcorpora.get('Results') # <Subcorpus: CORPUS:Results>
client.disconnect() # <class 'cqi.status.StatusByeOk'>