nlcst-normalize
Normalize a word for easier comparison, useful for NLCST
Installation
npm:
npm install nlcst-normalize
nlcst-normalize is also available for duo, and as an
AMD, CommonJS, and globals module, uncompressed and compressed.
Usage
var normalize = require('nlcst-normalize');
normalize('Don’t');
normalize('Don\'t');
normalize('Block-level');
normalize('Don’t', true);
normalize({
'type': 'WordNode',
'children': [
{
'type': 'TextNode',
'value': 'Block'
},
{
'type': 'PunctuationNode',
'value': '-'
},
{
'type': 'TextNode',
'value': 'level'
}
]
});
API
normalize(value[, allowApostrophes])
Quote a value.
Parameters
-
value
(Node
, Array.<Node>
, or string
)
— Value to normalize;
-
allowApostrophes
(boolean
, default: false
)
— Do not strip apostrophes (but do normalize them).
Returns: string
— Normalized value.
License
MIT © Titus Wormer