Translate queries from tree-based formats to sequential CQP format used by Corpus Workbench.
Project description
CQP/Tree
A framework to translate tree-style linguistic queries into sequential queries for use in Sketch Engine, Corpus Workbench or Korp.
Installation
This module requires Python version 3.12 or higher to be installed.
Installation is possible using pip.
pip install cqp-tree
If you want to run the current development version, you can clone this repository and install the package locally.
git clone https://github.com/Niklas-Deworetzki/cqp-tree.git
cd cqp-tree
pip install .
Get Started in the Browser
This package contains a local web-server. Running it allows you to open a website in your browser which has a user-friendly translation interface available.
cqp-tree-web
Running this command will start the server locally. Once it's started, click on the link displayed in your terminal or manually enter http://localhost:5000 to start translating queries. To stop the server again, press Ctrl and C in your terminal window.
Translating Queries
The module provides an executable called cqp-tree.
It can translate different queries into a common CQP representation and offers the most control over the translation process.
Currently, the following other query-languages are (partially) supported:
- Grew-match
- deptreepy
- CoNLL-U: this is not commonly intended as a query language, but (partial) trees in CoNLL-U format can be interpreted as queries. For details, see conll_frontend.md
In order to translate a query, you can provide it either via the command line, as the contents of a file or by directly typing it out into the program:
cqp-tree deptreepy --query 'TREE_ (pos NN) (AND (pos JJ) (word a.*))'
cqp-tree grew --file resources/example.grew
The converted query is, by default, printed to the screen.
Using the --output flag you can specify a file to which it should be written to instead.
Contributing
Feel free to add to this project. Read CONTRIBUTING.md to get started.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cqp_tree-0.1a1.tar.gz.
File metadata
- Download URL: cqp_tree-0.1a1.tar.gz
- Upload date:
- Size: 39.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e190bb1cf2bccaa15a14ca1379d87b2e84a2a5457bcf412a3d5f2ec62a85be5e
|
|
| MD5 |
1d957f292fc984967c61fd53d4205ef8
|
|
| BLAKE2b-256 |
480ac99200299a7d31de4db7e229d84a89e2e14f9a0a6ed2c8f28623c0365737
|
File details
Details for the file cqp_tree-0.1a1-py3-none-any.whl.
File metadata
- Download URL: cqp_tree-0.1a1-py3-none-any.whl
- Upload date:
- Size: 42.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb8cced09494140de71c761d07033da0a6d493d00341fb15b2931b0471350f95
|
|
| MD5 |
b8e70edf50ce6308fc04bb12df79539a
|
|
| BLAKE2b-256 |
71d612eceb3263e9f198d7cd27fec0f5921f039cac20b6bf30c375eebd105ce2
|