muraken720/nlcst-to-string

Transform a Natural Language Concrete Syntax Tree (NLCST) node into a string

★ 0Forks 0JavaScriptGitHub ↗Compare

README

nlcst-to-string Build Status Coverage Status

Transform an NLCST node into a string.

Installation

npm:

npm install nlcst-to-string

nlcst-to-string is also available for bower, component, and duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.

Usage

var nlcstToString = require('nlcst-to-string');

console.log(nlcstToString({
    "type": "WordNode",
    "data": {
        "partOfSpeech": [
            "NNP",
            "NN"
        ]
    },
    "children": [
        {
            "type": "TextNode",
            "value": "AT"
        },
        {
            "type": "PunctuationNode",
            "value": "&"
        },
        {
            "type": "TextNode",
            "value": "T"
        }
    ]
}));

Yields:

AT&T

API

toString(node)

Stringify an NLCST node (or an array of NLCST nodes).

Signatures

  • toString(node);
  • toString(nodes).

Parameters

  • node (NLCSTNode) — Node to to stringify.

  • nodes (Array.<NLCSTNode>) — Nodes to to stringify.

Returns

string — Stringified node / nodes.

License

MIT © Titus Wormer

Contributors

wooorm

Issues