Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nlcst-affix-emoticon-modifier

Package Overview
Dependencies
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nlcst-affix-emoticon-modifier

Merge affix emoticons into the previous sentence in NLCST

  • 1.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17K
increased by7.98%
Maintainers
2
Weekly downloads
 
Created
Source

nlcst-affix-emoticon-modifier

Build Coverage Downloads Size Sponsors Backers Chat

nlcst utility to move initial emoticons into the previous sentence. Useful because many people place an emoticon, representing emotion related to the previous sentence, after a terminal marker. :unamused:

Note: You probably want to use retext-emoji.

Install

npm:

npm install nlcst-affix-emoticon-modifier

Use

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

english.useFirst('tokenizeSentence', emoticon)
english.useFirst('tokenizeParagraph', affixEmoticon)

console.log(inspect(english.parse('Hey. :) How is it going?')))

Yields:

RootNode[1]
└─ ParagraphNode[3]
   ├─ SentenceNode[4]
   │  ├─ WordNode[1]
   │  │  └─ TextNode: 'Hey'
   │  ├─ PunctuationNode: '.'
   │  ├─ WhiteSpaceNode: ' '
   │  └─ EmoticonNode: ':)'
   ├─ WhiteSpaceNode: ' '
   └─ SentenceNode[8]
      ├─ WordNode[1]
      │  └─ TextNode: 'How'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1]
      │  └─ TextNode: 'is'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1]
      │  └─ TextNode: 'it'
      ├─ WhiteSpaceNode: ' '
      ├─ WordNode[1]
      │  └─ TextNode: 'going'
      └─ PunctuationNode: '?'

API

affixEmoticon(paragraph)

Merge affix emoticons (EmoticonNode) into the previous sentence.

Parameters
paragraph

The node to process (Paragraph).

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, organisation, or community you agree to abide by its terms.

License

MIT © Titus Wormer

Keywords

FAQs

Package last updated on 12 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc