JSPM

hashtagify

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q37963F
  • License MIT

Replace frequently repeating word combinations with hashtags in title, analyzing article content.

Package Exports

  • hashtagify

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (hashtagify) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm npm

hashtagify

Replace frequently repeating word combinations with hashtags in title, analyzing article content.

This module extracts words combinations from the given title string and search them in the content string. In case when the number of search entrances is more then 1, search combination is considered to be a hashtag. The longest combinations are prioritized. Also user vocabulary can be used to hashtag specific words.

var title = "My title with the repeating phrase and an important word.";
var content = "Description containing the same repeating phrase couple of times (repeating phrase)."
var vocabulary = ['important'];

var newTitle = hashtagify(title,content,vocabulary);
// My title with the #RepeatingPhrase and an #Important word.

Install

npm install hashtagify

or

bower install hashtagify

Configure

You can enable a debug mode to check a console hashtagifying process.

//Enable debug output to console
hashtagify.debug=true;

There is also a couple of postprocess enhancements enabled by default. You can turn them off.

A word followed by a number character is merged together and considered a hashtag. Example: "word 7" => "#Word7". Enabled by default.

//Disable "word 7" => "#Word7"
hashtagify.doFollowedByNumber=false;

A word with a dash or a dot inside it, is CamelCased and considered a hashtag. Example: "dash-or.dot" => "#DashOrDot". Enabled by default.

//Disable "dash-or.dot" => "#DashOrDot"
hashtagify.doDottedAndDashed=false;