{"library":"nlcst-normalize","title":"NLCST Normalize Utility","description":"nlcst-normalize is a utility within the unified ecosystem, specifically designed for working with Natural Language Concrete Syntax Tree (NLCST) nodes. Its primary function is to serialize and clean words, making them easier to compare consistently. The current stable version is 4.0.0. The package generally follows a release cadence tied to Node.js LTS versions, dropping support for unmaintained Node.js versions with major releases. Key differentiators include its integration with the broader unified collective for natural language processing, its ability to normalize various word forms (e.g., smart vs. straight apostrophes) and handle specific punctuation like hyphens and apostrophes based on configurable options. This makes it particularly useful for tasks such as building keyword matchers or creating indexes where slight variations in word formatting need to be reconciled.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install nlcst-normalize"],"cli":null},"imports":["import { normalize } from 'nlcst-normalize'","import type { Options } from 'nlcst-normalize'","import {normalize} from 'https://esm.sh/nlcst-normalize@4'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { normalize } from 'nlcst-normalize';\n\n// Normalize simple strings\nconsole.log(normalize(\"Don't\")); // => 'dont'\nconsole.log(normalize('Don’t')); // => 'dont'\n\n// Normalize with options to retain specific punctuation\nconsole.log(normalize('Don’t', { allowApostrophes: true })); // => 'don\\'t'\nconsole.log(normalize('Block-level')); // => 'blocklevel'\nconsole.log(normalize('Block-level', { allowDashes: true })); // => 'block-level'\n\n// Normalize an NLCST WordNode object\nconst wordNode = {\n  type: 'WordNode',\n  children: [\n    { type: 'TextNode', value: 'Example' },\n    { type: 'PunctuationNode', value: '-' },\n    { type: 'TextNode', value: 'word' }\n  ]\n};\nconsole.log(normalize(wordNode)); // => 'exampleword'\n","lang":"typescript","description":"This quickstart demonstrates how to use the `normalize` function with various string inputs, including options to control punctuation stripping, and how to pass an NLCST `WordNode` object for normalization.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}