Skip to main content

CQP and CL interfaces for Python

Project description

This is a Python wrapper to the low-level API of CQP which allows
you to access CQP corpora in the same way as Perl's CWB::CL

If you installed CQP in a non-standard location (which is the default for
newer versions of CQP), point the setup in the right direction with, e.g.
export CWB_DIR=/usr/local/cwb-3.4.10

To install the module, use the standard
python setup.py build
sudo python setup.py install
command sequence.

As a prerequisite, install Cython with
pip install Cython

If you use an old version of CQP (CWB 2.99 and older), you need to
change the value of the "extra_libs" variable in setup.py.

To give you an idea how to use the library, see the following sample:

--- 8< ---
from CWB.CL import Corpus

# open the corpus
corpus=Corpus('TUEPP')
# get sentences and words
sentences=corpus.attribute('s','s')
words=corpus.attribute('word','p')
postags=corpus.attribute('pos','p')
# retrieve offsets of the 1235th sentence (0-based)
s_1234=sentences[1234]

for w,p in zip(words[s_1234[0]:s_1234[1]+1],postags[s_1234[0]:s_1234[1]+1]):
print "%s/%s"%(w,p)

--- 8< ---

In order to test the CWB.CL module's correct installation
independently of any CQP corpora, you can do a
python -m doctest tests/idlist.txt
which should terminate with no output when everything is well.

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

cwb-python-0.2.2.tar.gz (69.2 kB view details)

Uploaded Source

Built Distributions

cwb_python-0.2.2-cp36-cp36m-manylinux1_x86_64.whl (302.6 kB view details)

Uploaded CPython 3.6m

cwb_python-0.2.2-cp36-cp36m-macosx_10_12_x86_64.whl (108.9 kB view details)

Uploaded CPython 3.6m macOS 10.12+ x86-64

cwb_python-0.2.2-cp35-cp35m-manylinux1_x86_64.whl (299.2 kB view details)

Uploaded CPython 3.5m

cwb_python-0.2.2-cp27-cp27mu-manylinux1_x86_64.whl (286.7 kB view details)

Uploaded CPython 2.7mu

cwb_python-0.2.2-cp27-cp27m-manylinux1_x86_64.whl (286.7 kB view details)

Uploaded CPython 2.7m

cwb_python-0.2.2-cp27-cp27m-macosx_10_12_x86_64.whl (111.3 kB view details)

Uploaded CPython 2.7m macOS 10.12+ x86-64

File details

Details for the file cwb-python-0.2.2.tar.gz.

File metadata

  • Download URL: cwb-python-0.2.2.tar.gz
  • Upload date:
  • Size: 69.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cwb-python-0.2.2.tar.gz
Algorithm Hash digest
SHA256 1e45ed5ab2bd95838049505f0adf599ada5bf33989e789220b7ee7852cfbc178
MD5 eac202e493e2185df9924d5beb580f96
BLAKE2b-256 9dcb9f9faaf4ec9e73e32fc06403744e9a49192499636a9e8efeb876b939c74e

See more details on using hashes here.

File details

Details for the file cwb_python-0.2.2-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cwb_python-0.2.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 e71f7cb194d865eaebd8bbf68ca6478fa3feb350b3e5953bada8380fad609002
MD5 63a1ffb48ebec8d0f1f5cdd0ce6fc251
BLAKE2b-256 424670090003866fe92e3939e8c1753efe6180bae0411231c3303659cc909e22

See more details on using hashes here.

File details

Details for the file cwb_python-0.2.2-cp36-cp36m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cwb_python-0.2.2-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 40286bb8bf3d18ba1b05503338cccf36ecf4015e298c7c287763d5a9c3e6e89a
MD5 3b799799f723c515a006e19255072e46
BLAKE2b-256 c3a3d1c1074db01a5af22d88720c079c7a8f52efe4b08fde61371b58d9b9f1cc

See more details on using hashes here.

File details

Details for the file cwb_python-0.2.2-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cwb_python-0.2.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 4280ef744ee740fd724c1bef0b4d8fe426ec7b020e2ca35f83f2a42caf5b6e2c
MD5 d90c0d70ded6deb45474a3fc4a416a8a
BLAKE2b-256 8ff05a03a3da984354b886d8c0c11a5903869f35997dcacb1e18527a79ccf082

See more details on using hashes here.

File details

Details for the file cwb_python-0.2.2-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cwb_python-0.2.2-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 70c51d788779cdb699b02e683073b7d2babf1a574980d286e5f344c685a354a0
MD5 2865c5bd56cdfc43888e06d4636af460
BLAKE2b-256 6fd7bb6fa6acb8c238e89baf91194631dd1c7833513a62dea7974348af55ea29

See more details on using hashes here.

File details

Details for the file cwb_python-0.2.2-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for cwb_python-0.2.2-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 0005a252727b9898e2f1af4ad93aae804142fc792fe26493ad99021cbcdaa6bf
MD5 0943c9af10f73a1f007647d9ad9def02
BLAKE2b-256 87526cc1b07473896999f0891bc32623130b4a0597d6d488b983dbf3bb920f49

See more details on using hashes here.

File details

Details for the file cwb_python-0.2.2-cp27-cp27m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for cwb_python-0.2.2-cp27-cp27m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 93e7b429e492840795ef9556890c141a5ef7ac485adb1d9bc99aa20daa8db9cc
MD5 5609026240bd1f50c27f80a5c97621ee
BLAKE2b-256 80e100f0f3e89082e2b778ff58ac304b5afcab44ade029c326ad4a49a8a94b9b

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