unified

Project: syntax-tree/nlcst-emoticon-modifier

Package: nlcst-emoticon-modifier@1.1.4

  1. Dependencies: 3·Dependents: 2
  2. nlcst utility to support emoticons in nlcst
  1. util 106
  2. utility 104
  3. unist 97
  4. nlcst 13
  5. nlcst-util 8
  6. emoticon 4

nlcst-emoticon-modifier

Build Coverage Downloads Size Sponsors Backers Chat

nlcst utility to classify ASCII emoticons as EmoticonNodes.

Note: You probably want to use retext-emoji.

Install

npm:

npm install nlcst-emoticon-modifier

Use

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

var sentence = english().parse('This makes me feel :).').children[0].children[0]

modifier(sentence)

console.log(inspect(sentence))

Yields:

SentenceNode[10]
├─ WordNode[1]
│  └─ TextNode: 'This'
├─ WhiteSpaceNode: ' '
├─ WordNode[1]
│  └─ TextNode: 'makes'
├─ WhiteSpaceNode: ' '
├─ WordNode[1]
│  └─ TextNode: 'me'
├─ WhiteSpaceNode: ' '
├─ WordNode[1]
│  └─ TextNode: 'feel'
├─ WhiteSpaceNode: ' '
├─ EmoticonNode: ':)'
└─ PunctuationNode: '.'

API

emoticon(sentence)

Classify ASCII emoticons as EmoticonNodes.

Parameters
sentence

Node to process (Sentence).

Contribute

See contributing.md in syntax-tree/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormer