Phrase Tree
Converts the penn tagged phrase structure tree from the Stanford parser to a regular Javascript object tree.
Install
npm install phrase-tree
Usage
// inputFromParser =// (S// (NP (DT The) (NN boy))// (VP (VBD saw)// (NP (DT a) (NN dog))))) var convert = var tree = console//{// "tag": "S",// "tex": "",// "children": [// {// "tag": "NP",// "tex": "",// "children": [// {// "tag": "DT",// "tex": "The",// "children": []// },// {// "tag": "NN",// "tex": "boy",// "children": []// }// ]// },// {// "tag": "VP",// "tex": "",// "children": [// {// "tag": "VBD",// "tex": "saw",// "children": []// },// {// "tag": "NP",// "tex": "",// "children": [// {// "tag": "DT",// "tex": "a",// "children": []// },// {// "tag": "NN",// "tex": "dog",// "children": []// }// ]// }// ]// }// ]//}
License
MIT © Harris Jose