Skip to content
Converter for bracketed annotation syntax trees, generating a PCFG, dominance relations, scope, c-command
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Copyright 2018 by Damir Cavar

Version: 0.1

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


This is a tree reader that processes syntactic parse trees as generated by constituent parsers, including Lexical functional Grammar (LFG) c-structures or parse trees that have been generated by Probabilistic Context-free Grammar (PCFG) parsers.

Example tree structure from Wikipedia

Such parsers generate syntactic structures for natural language sentences encode scope relations between constituents, dominance, c-command, and linear order or precedence relations.

They also encode the syntactic production rules of a grammar that is necessary to parse or generate such natural language sentences. By analyzing the tree we can extract and uantify the rules, as well as reconstruct the hierarchical and linear relations of words and syntactic constituents.

There are various ways to encode such trees in form of textual representations. A popular one is to use a bracketed notation with either round or square brackets. The tree structure above could be encoded using square brackets as:

[S [N John ] [VP [V hit ] [NP [D the ] [N ball ] ] ] ]

TreeProcessor converts for bracketed annotation syntax trees that are often the output of Natural Language Processing (NLP) tools to a set of syntactic phrase structure rules with quantification, that is generating a PCFG. It also computes all relations between nodes in the tree, in particular dominance relations, government, scope, c-command, and precedence. For each single node with its generated ID one can query structural information that is relevant for various NLP tasks and deeper Natural Language Understanding (NLU).

Testing and Running

To test the tool, run it over the included trees.txt file, first compile the code:

mvn compile

Package the binary in a jar-file:

mvn package

Run the test with the following command line:

java -jar target/TreeProcessor-1.0-SNAPSHOT-jar-with-dependencies.jar -t
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.