{"library":"nlcst-affix-emoticon-modifier","title":"NLCST Affix Emoticon Modifier","description":"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.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install nlcst-affix-emoticon-modifier"],"cli":null},"imports":["import { affixEmoticonModifier } from 'nlcst-affix-emoticon-modifier'","import type { Emoticon } from 'nlcst-emoticon-modifier'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import {affixEmoticonModifier} from 'nlcst-affix-emoticon-modifier'\nimport {emoticonModifier} from 'nlcst-emoticon-modifier'\nimport {ParseEnglish} from 'parse-english'\nimport {inspect} from 'unist-util-inspect'\n\nconst parser = new ParseEnglish()\n// Register emoticonModifier to tokenize emoticons into EmoticonNodes\nparser.tokenizeSentencePlugins.unshift(emoticonModifier)\n// Register affixEmoticonModifier to move these nodes after terminal punctuation\nparser.tokenizeParagraphPlugins.unshift(affixEmoticonModifier)\n\nconst text = 'Hey. :) How is it going?'\nconst tree = parser.parse(text)\n\nconsole.log(inspect(tree))\n/* Expected output will show ' :)' moved into the first sentence. */","lang":"typescript","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}