Skip to content

A modification of the PyCQP_interface shipped with cwb-python

License

Notifications You must be signed in to change notification settings

chozelinek/PyCQP_interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

My PyCQP_interface

Due to problems installing the package cwb-python in Mac OS and some usage problems thereafter, I decided to take the PyCQP_interface.py and modify it for my own needs.

This package works with Python >= 3.

Requirements:

  • six

Install

I recommend to install this package in a virtual environment.

With pip directly from GitHub:

pip install -e git+https://github.com/chozelinek/PyCQP_interface.git#egg=pycqp-interface

Usage

import PyCQP_interface
# name of the corpus to Query
corpus_name = "EP-EN-TT"
# path to your registry
registry_dir = "~/CORPORA/registry"
# start a CQP session
cqp = PyCQP_interface.CQP(bin='cqp', options='-c -r ' + registry_dir)
# select the corpus
cqp.Exec(corpus_name)
# get all tokens in corpus
cqp.Query("[]")
# get size in tokens
cqp.Exec("size Last")
# end session
cqp.Terminate()

About

A modification of the PyCQP_interface shipped with cwb-python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages