{"id":18754043,"url":"https://github.com/dcavar/treeprocessor","last_synced_at":"2026-07-03T10:03:26.063Z","repository":{"id":150221180,"uuid":"143572367","full_name":"dcavar/TreeProcessor","owner":"dcavar","description":"Converter for bracketed annotation syntax trees, generating a PCFG, dominance relations, scope, c-command","archived":false,"fork":false,"pushed_at":"2018-08-08T03:05:28.000Z","size":47,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-28T19:07:06.054Z","etag":null,"topics":["ai","cfg","constituent-structure","java","nlp","parsing","pcfg","phrase-structure-tree","syntax","treebank"],"latest_commit_sha":null,"homepage":"http://damir.cavar.me/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcavar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-08-05T00:31:55.000Z","updated_at":"2019-06-09T22:01:18.000Z","dependencies_parsed_at":"2023-04-08T10:37:55.973Z","dependency_job_id":null,"html_url":"https://github.com/dcavar/TreeProcessor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dcavar/TreeProcessor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavar%2FTreeProcessor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavar%2FTreeProcessor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavar%2FTreeProcessor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavar%2FTreeProcessor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcavar","download_url":"https://codeload.github.com/dcavar/TreeProcessor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcavar%2FTreeProcessor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35081255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-03T02:00:05.635Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","cfg","constituent-structure","java","nlp","parsing","pcfg","phrase-structure-tree","syntax","treebank"],"created_at":"2024-11-07T17:27:54.652Z","updated_at":"2026-07-03T10:03:26.014Z","avatar_url":"https://github.com/dcavar.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TreeProcessor\n\nCopyright 2018 by [Damir Cavar](http://damir.cavar.me/)\n\n\nVersion: 0.1\n\nLicensed 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\n\n[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\nUnless 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.\n\n\n## Introduction\n\nThis 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\nthat have been generated by [Probabilistic Context-free Grammar](https://en.wikipedia.org/wiki/Probabilistic_context-free_grammar) ([PCFG]) parsers.\n\n![Example tree structure from Wikipedia](File:ParseTree1.png)\n\nSuch parsers generate syntactic structures for natural language sentences encode scope relations between constituents, dominance, c-command, and linear order or precedence relations.\n\nThey 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.\n\nThere 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:\n\n\t[S [N John ] [VP [V hit ] [NP [D the ] [N ball ] ] ] ]\n\nTreeProcessor 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]).\n\n\n## Testing and Running\n\nTo test the tool, run it over the included trees.txt file, first compile the code:\n\n\tmvn compile\n\nPackage the binary in a jar-file:\n\n\tmvn package\n\nRun the test with the following command line:\n\n\tjava -jar target/TreeProcessor-1.0-SNAPSHOT-jar-with-dependencies.jar -t\n\n\n\n\n[NLP]: https://en.wikipedia.org/wiki/Natural_language_processing \"Natural Language Processing\"\n[LFG]: https://en.wikipedia.org/wiki/Lexical_functional_grammar \"Lexical Functional Grammar\"\n[PCFG]: https://en.wikipedia.org/wiki/Probabilistic_context-free_grammar \"Probabilistic Context-free Grammar\"\n[NLU]: https://en.wikipedia.org/wiki/Natural_language_understanding \"Natural Language Understanding\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcavar%2Ftreeprocessor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcavar%2Ftreeprocessor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcavar%2Ftreeprocessor/lists"}