Skip to content

dcavar/TreeProcessor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TreeProcessor

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

http://www.apache.org/licenses/LICENSE-2.0

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.

Introduction

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

About

Converter for bracketed annotation syntax trees, generating a PCFG, dominance relations, scope, c-command

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages