Treebank StudioDocumentation

Coming from CorpusSearch

While many places in the PaCQL documentation make connections with CorpusSearch, this is a page that collect some of the most important similarities and differences thematically.

CorpusSearch has had an amazing impact on research in historical syntax, and while Treebank Studio aims to offer improvements, the fact that we are doing this kind of research at all goes back to work on CS and related projects at the University of Pennsylvania. CS was written by Beth Randall and the project was directed by Tony Kroch. The design of CS is due to Beth Randall, Tony Kroch, and Ann Taylor (see CS information pages). CS is an immensely successful system, and beyond being a system, it defines a certain way of thinking about treebank research.

Speed

It must be mentioned that PaCQL queries run on the Treebank Studio search engine are faster than CorpusSearch queries. By one measure in testing thousands of equivalent queries, Treebank Studio was about 270 times faster. This is particularly noticable in complex coding queries.

Relations

PaCQL offers the same relations as CorpusSearch, including doms, idoms, precedes, idomsviatrace and others that will be familiar to CS users. In PaCQL, the convention is to write these in all lowercase, but like in CS, aliases are supported, so while the examples here show idoms, you can write iDoms if you prefer that.

Nodes and leaves

While CS treats everything as nodes, PaCQL treats everything as nodes except the leaves (terminals) in the tree. This means that while idoms works as you are used to when relating two phraes or a phrase and a PoS-tag, idoms does not see words. For that you must use special relations, idomsleaf, idomslemma, and idomsempty. Of these, idomsleaf works basically the same as A idoms B in CS where B is a leaf, but idomslemma matches lemma B, and idomsempty has a shortcut syntax for empty categories, so you can write NP-SBJ idomsempty exp. It also works to use the patterns you are used to like \*exp\*, but it is not needed.

PaCQL uses plain standard regular expressions

CS users are used to special wildcards in patterns like NP-SBJ* where the * means that anything can come after the J. This is not standard regular expression syntax. If you want to achieve the same in PaCQL, write NP-SBJ.* instead.

On node and anchor

In CS, one uses node: to search within some type of node or nodes and get results that are matched within the node. There is no equivalent node in PaCQL, but instead there is an anchor, and one name (pattern for a label) in the query is the anchor. By default, this is the first name that you type, such as IP-SUB in a query that starts IP-SUB idoms NP-SBJ. The results are reporting how many of these anchors match the pattern described by the query. If you want some other node in the query to be the anchor, prefix it with @. For example IP-SUB idoms @NP-.* gives one result for each NP that is the daughter of a finite subordinate clause.

Restricting locality

CS had workflows for restricting locality that involved removing nodes from results and then searching the output with these removed. In PaCQL, there is no equivalent workflow, but in many cases, the same patterns can be expressed using domslocal, a relation that allows you to express A dominates B, but C is a barrier for how far doms sees. See documentation for this relation for more details.

Help reading the queries

If you have written a query but would like to get more details on what it means, exactly, there is a button in the user interface that shows how to read the query. You may not need this, but if you are in doubt, try the button and see if it is more clear what is meant.

Logic: and, or, not

CS has great support for expressing logic in its syntax, but as its manual says, it varies how dependable the meaning of logical operations is in how it works. Conjunction works well but OR and NOT over relations are less safe to use, and while it allows for nested combinations of these, they are not guaranteed to work right. Negation of labels mostly works, but not in all cases. PaCQL has ways to express such logic at various levels, and theoretically, and by a bunch of testing, these work right, but do send a message if it does not for you. There is a special section in the documentation that covers all of this. That includes nested recursive logical operations in logic variables, but only over the output of other variables present in the context. For simpler logic, you can express it within the regular part of the query. Negated relations like A !idoms B mean that A does not idom any B, but negated names like A idoms !B mean A idoms some B that does not match the regular expression B. For negation of a whole pattern, a none: block can be used, and either:/or: sections express simple disjunction over whole patterns (here we are using whole pattern in the sense of one or more query lines). Read the other sections of the documentation for more details. PaCQL does function correctly in some cases where CS is expected to match negation but does not.