hashtagify

1.0.2 • Public • Published

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;
 

Package Sidebar

Install

npm i hashtagify

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • ytiurin