nlcst-affix-emoticon-modifier is a utility within the unified ecosystem designed to process Natural Language Concrete Syntax Tree (NLCST) nodes. Its primary function is to identify and re-position emoticons that appear at the beginning of a sentence, moving them to the end of the preceding sentence. This addresses common linguistic patterns where users place emoticons as a reaction to the previous thought, even after terminal punctuation. The current stable version is 3.0.0, which requires Node.js 16+. While a low-level utility, it forms a crucial part of more abstracted tools like `retext-emoji`. The project follows semver for releases, with significant breaking changes in major versions, particularly the move to ESM-only in v2 and further API adjustments in v3.
npm install nlcst-affix-emoticon-modifierVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to parse a sentence with an initial emoticon and then use `affixEmoticonModifier` to move it into the previous sentence in the NLCST tree.
Migrate your project to use ES modules (`import`/`export` syntax). Ensure your `package.json` specifies `"type": "module"` or use `.mjs` file extensions for ES module files.
Upgrade your Node.js runtime environment to version 16 or a newer LTS release.
Avoid relying on internal or undocumented paths. Always import public APIs directly from the main package entry point, e.g., `import { affixEmoticonModifier } from 'nlcst-affix-emoticon-modifier'`.If you were importing the `Emoticon` type, you must now import it from `nlcst-emoticon-modifier` instead: `import type { Emoticon } from 'nlcst-emoticon-modifier'`.Update your import statement to use ES module syntax: `import { affixEmoticonModifier } from 'nlcst-affix-emoticon-modifier'`. Ensure your project's `package.json` has `"type": "module"` or you are using `.mjs` file extensions.Ensure your Node.js version is 16 or newer. Verify that your project is correctly configured for ES modules, using `import` statements and appropriate `package.json` settings.
The `Emoticon` type has been moved. Import it from `nlcst-emoticon-modifier` instead: `import type { Emoticon } from 'nlcst-emoticon-modifier'`.