nlcst-emoticon-modifier

3.0.1 · active · verified Sun Apr 19

nlcst-emoticon-modifier is a specialized utility within the `unified` ecosystem, designed to process Natural Language Concrete Syntax Trees (NLCST). It identifies ASCII-based emoticons (e.g., `:)`, `:(`) within text and transforms them into dedicated `EmoticonNode` objects in the syntax tree. This package is currently stable at version `3.0.1` and follows the `unified` collective's release strategy, which typically involves new major versions for significant breaking changes like Node.js version updates or module system transitions. It is a foundational tool for natural language processing, offering a precise way to classify emoticons, distinguishing itself by its integration with the `nlcst` specification and its ESM-only distribution. Higher-level plugins, such as `retext-emoji`, build upon this utility for broader emoji and emoticon support.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to integrate `emoticonModifier` into a `ParseEnglish` pipeline to transform ASCII emoticons into `EmoticonNode`s within an NLCST sentence, then inspects the resulting tree.

import { emoticonModifier } from 'nlcst-emoticon-modifier';
import { ParseEnglish } from 'parse-english';
import { inspect } from 'unist-util-inspect';

const parser = new ParseEnglish();
parser.tokenizeSentencePlugins.unshift(emoticonModifier);

const sentence = parser.parse('This makes me feel :).').children[0].children[0];

console.log(inspect(sentence));

view raw JSON →