# 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.

```javascript
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.

```javascript
{
  "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
