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.
npm install nlcst-normalizeVerified import paths — ran on the pinned version, not inferred.
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.
Upgrade your Node.js environment to version 16 or newer. For projects that cannot upgrade, consider using nlcst-normalize@^3.
Migrate your codebase to use ECMAScript Modules (ESM) syntax with `import` statements. Ensure your project is configured for ESM (e.g., `"type": "module"` in package.json or using `.mjs` file extensions).
Update your TypeScript code to use `Options` instead of `NormalizeOptions` when defining or importing the configuration type.
If you need to preserve apostrophes or hyphens, pass `{ allowApostrophes: true }` or `{ allowDashes: true }` respectively in the options object to the `normalize` function.Change `const { normalize } = require('nlcst-normalize')` to `import { normalize } from 'nlcst-normalize'`.Always import symbols directly from the main package entry point: `import { normalize } from 'nlcst-normalize'`.Replace `NormalizeOptions` with `Options` in your TypeScript type imports and declarations.
No dependency data recorded yet.