dozoisch / nlcst-emoji-modifier

Emoji in NLCST

Home Page:https://unifiedjs.github.io

Repository from Github https://github.comdozoisch/nlcst-emoji-modifierRepository from Github https://github.comdozoisch/nlcst-emoji-modifier

nlcst-emoji-modifier Build Status Coverage Status

Classify unicode emoji and Gemoji shortcodes as EmoticonNodes.

Implemented by retext-emoji, but separated for use by standalone (non-retext) processing.

Installation

npm:

npm install nlcst-emoji-modifier

Usage

var modifier = require('nlcst-emoji-modifier');
var inspect = require('unist-util-inspect');
var english = require('parse-english')();

english.useFirst('tokenizeSentence', modifier);

console.log(inspect(english.parse('It\'s raining :cat:s and :dog:s.')));

Yields:

RootNode[1]
└─ ParagraphNode[1]
   └─ SentenceNode[11]
      ├─ WordNode[3]
      │  ├─ TextNode: "It"
      │  ├─ PunctuationNode: "'"
      │  └─ TextNode: "s"
      ├─ WhiteSpaceNode: " "
      ├─ WordNode[1]
      │  └─ TextNode: "raining"
      ├─ WhiteSpaceNode: " "
      ├─ EmoticonNode: ":cat:"
      ├─ WordNode[1]
      │  └─ TextNode: "s"
      ├─ WhiteSpaceNode: " "
      ├─ WordNode[1]
      │  └─ TextNode: "and"
      ├─ WhiteSpaceNode: " "
      ├─ EmoticonNode: ":dog:"
      └─ WordNode[2]
         ├─ TextNode: "s"
         └─ PunctuationNode: "."

API

emoji(paragraph)

Merge emoji and gemoji into a new EmoticonNode.

Parameters

License

MIT © Titus Wormer

About

Emoji in NLCST

https://unifiedjs.github.io

License:MIT License


Languages

Language:JavaScript 100.0%