Skip to main content

Translate queries from tree-based formats to sequential CQP format used by Corpus Workbench.

Project description

CQP/Tree

CI Pipeline GitHub Tag GitHub License

A framework to translate tree-style linguistic queries into sequential queries for use in Corpus Workbench or Korp, with plans to soon support Sketch Engine.

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:31495 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:

  1. Grew-match
  2. dep_search we have some documentation on supported features and extensions
  3. deptreepy
  4. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cqp_tree-0.2a1.tar.gz (53.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cqp_tree-0.2a1-py3-none-any.whl (57.9 kB view details)

Uploaded Python 3

File details

Details for the file cqp_tree-0.2a1.tar.gz.

File metadata

  • Download URL: cqp_tree-0.2a1.tar.gz
  • Upload date:
  • Size: 53.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for cqp_tree-0.2a1.tar.gz
Algorithm Hash digest
SHA256 60f2b5e6159e3588f7753336f819753071489ae7cc237741b27fb3d20953bf08
MD5 42364334649024cf6c9f99a2bd184c5c
BLAKE2b-256 586d3955d4cc8b2d63ab918ae274a575cdb308cefef531f09b82917af84fa2a9

See more details on using hashes here.

File details

Details for the file cqp_tree-0.2a1-py3-none-any.whl.

File metadata

  • Download URL: cqp_tree-0.2a1-py3-none-any.whl
  • Upload date:
  • Size: 57.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for cqp_tree-0.2a1-py3-none-any.whl
Algorithm Hash digest
SHA256 02a178c9e7a8f3975dd1ca9822d97cad0614cccee9ff138c3638c976f77663e0
MD5 b037bbccd19d5c4a1460183423226a15
BLAKE2b-256 7dda5ee4656335f478b6bf8d245cd4571714b2b1d0738241bba0532f8012fe71

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page