A Python library for the IMS Open Corpus Workbench (CWB) Corpus Query Interface (CQi) API.
The latest stable version is available on PyPI. Either add cqi
to your requirements.txt
file or install with pip:
pip install cqi
Package version | Protocol version |
---|---|
0.1.0 - 0.1.7 | 0.1 |
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'>