0.2.0 • Published 11 years ago

treebank-parser v0.2.0

Weekly downloads
2
License
AGPL-3.0
Repository
-
Last release
11 years ago

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
0.2.0

11 years ago

0.1.0

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago