CQP/Tree

What is CQP/Tree?

CQP/Tree converts human-readable syntactic tree queries into CQL for use in Sketch Engine, Korp, Corpus Workbench and related corpus search systems. This installation is primarily intended to support syntactic searching in {% if cfg.homepage %} {{ cfg.system_name }} {% else %} {{ cfg.system_name }} {% endif %} corpora, but the generated queries can also be used with other Sketch Engine-compatible or Corpus Workbench-compatible corpora and platforms.

Getting started

CQP/Tree supports three main input languages: Grew-match, depsearch and deptreepy All three languages prioritize making it easy to search for syntactic relations between tokens.

If you wanted to look for ditransitive predicates in a Universal Dependencies treebank, for instance, you could write the Grew query {% with name="grew", code='''pattern { A [upos=\"VERB\"]; % there is a token called A whose UPOS tag is VERB A -[obj]-> B; % A has a dependent, B, which is labelled as its direct (obj) A -[iobj]-> C % A also has another dependent, C, labelled as indirect object (iobj) }''' %} {% include "snippet.html" %} {% endwith %} In depsearch, you could write the same query as {% with name="depsearch", code="VERB >obj _ >iobj _" %} {% include "snippet.html" %} {% endwith %} whose deptreepy equivalent is {% with name="deptreepy", code="TREE_ (POS VERB) (DEPREL obj) (DEPREL iobj)" %} {% include "snippet.html" %} {% endwith %}

CQP/Tree can convert all of these syntaxes to CQL and allows you to run them directly on your corpus of choice. To get started, try copying and pasting one of the queries above into the web interface!

For some more advanced examples, follow this link.

Note on recall

Translated queries may differ from native syntactic search tools in terms of precision and recall, especially for complex multi-token queries. For details on the translation approach, evaluation and known limitations, see Section 7 of the accompanying paper.

How to cite

If you use CQP/Tree in your research, you are welcome to cite Niklas Deworetzki and Arianna Masciolini. Syntactic Sugar for Syntactic Queries: Sequential Representations for Dependency Queries. In Proceedings of the Fifteenth Language Resources and Evaluation Conference (LREC 2026): {% with name="bibtex", code="""@inproceedings{deworetzki-etal-2026-syntactic, title = {Syntactic Sugar for Syntactic Queries: Sequential Representations for Dependency Queries}, author = {Deworetzki, Niklas and Masciolini, Arianna}, booktitle = {Proceedings of the Fifteenth Language Resources and Evaluation Conference ({LREC} 2026)}, month = {May}, year = {2026}, pages = {11669--11678}, address = {Palma, Mallorca, Spain}, publisher = {European Language Resources Association (ELRA)}, editor = {Piperidis, Stelios and Bel, Núria and van den Heuvel, Henk and Ide, Nancy and Krek, Simon and Toral, Antonio}, doi = {10.63317/2vfu2ssa33us}, }""" %} {% include "snippet.html" %} {% endwith %}

Acknowledgments

This service is based on the CQP/Tree tool developed by Niklas Deworetzki and Arianna Masciolini, with the support of Språkbanken – jointly funded by its 10 partner institutions and the Swedish Research Council (2025–2028; project id 2023-00161). The CLARIN integration was coordinated by Kaja Dobrovoljc Zor with the support of a CLARIN Mobility Grant and the ARIS-funded projects GC-0002 (LLM4DH: Large Language Models for Digital Humanities) and J6-70213 (MAPCASE: Mapping case architectures in Slovenian and across languages).

version {{ version or 'distributed via PyPi' }}