Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dcavar/treeprocessor

Converter for bracketed annotation syntax trees, generating a PCFG, dominance relations, scope, c-command
https://github.com/dcavar/treeprocessor

ai cfg constituent-structure java nlp parsing pcfg phrase-structure-tree syntax treebank

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

# TreeProcessor

Copyright 2018 by [Damir Cavar](http://damir.cavar.me/)

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](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](https://en.wikipedia.org/wiki/Parse_tree) as generated by constituent parsers, including [Lexical functional Grammar](https://en.wikipedia.org/wiki/Lexical_functional_grammar) ([LFG]) [c-structures](https://en.wikipedia.org/wiki/Lexical_functional_grammar) or parse trees
that have been generated by [Probabilistic Context-free Grammar](https://en.wikipedia.org/wiki/Probabilistic_context-free_grammar) ([PCFG]) parsers.

![Example tree structure from Wikipedia](File:ParseTree1.png)

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](https://en.wikipedia.org/wiki/Natural_language_processing) ([NLP]) tools to a set of syntactic [phrase structure rules](https://en.wikipedia.org/wiki/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](https://en.wikipedia.org/wiki/Government_(linguistics)), scope, [c-command](https://en.wikipedia.org/wiki/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](https://en.wikipedia.org/wiki/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

[NLP]: https://en.wikipedia.org/wiki/Natural_language_processing "Natural Language Processing"
[LFG]: https://en.wikipedia.org/wiki/Lexical_functional_grammar "Lexical Functional Grammar"
[PCFG]: https://en.wikipedia.org/wiki/Probabilistic_context-free_grammar "Probabilistic Context-free Grammar"
[NLU]: https://en.wikipedia.org/wiki/Natural_language_understanding "Natural Language Understanding"