treebank-parser

0.2.0 • Public • Published

treebank-parser

Treebank Parser is a simple parser for treebanks stored in S-Expressions.

Installation

To install treebank-parser as a module in your project, type the following command.

npm install treebank-parser --save

Use

You can use treebank-parser to obtain treebank sentences in a corresponding collection of arrays.

var parser = require('treebank-parser');
 
var treebank = [
    '(ROOT'
  , '  (S'
  , '    (VP (VB Get)'
  , '      (NP (NNS coins)))'
  , '    (. .)))'
].join('\n');
 
console.log(JSON.stringify(treebank));

This program prints the following output.

{
  "ROOT_0": {
    "S_0": {
      "VP_0": {
        "VB_0": "Get",
        "NP_0": {
          "NNS_0": "coins"
        }
      },
      "._0": "."
    }
  }
}

Testing

You can run the included unit tests with the following command.

npm test

Readme

Keywords

Package Sidebar

Install

npm i treebank-parser

Weekly Downloads

1

Version

0.2.0

License

AGPL-3.0

Last publish

Collaborators

  • elzair