Code Monkey home page Code Monkey logo

treeprocessor's Introduction

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

treeprocessor's People

Contributors

dcavar avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.