Module: nlp/nlp

nlp is the language processing module in the package. It serves various requirements of Content Holmes like interest determination and POS tagging.

Example

Using the interest module requires a tedious amount of work. It is not tough though.
You usually fallow these steps in order:

  1. Set a buffer object type. Initialize it by {}.
  2. Use interest(old_interests, query) to get new interests.
  3. Save the buffer. Initialize the buffer next time by this value.

var nlp = require('nlp.js');
nlp.setBuffer(buffer);
nlp.interest(interests, "Justice League", function(interests, new_buffer) {
		console.log("New interests are "+ interests);
		console.log("New Buffer are " + new_buffer);
});

Members


<inner> MAX_LENGTH

Maximum number of interests in the interests array.

<inner> pickup_categories

Parts of speech picked up by the interest analyzer

<inner> sentiment_categories

Parts of speech picked up by the sentiment analyzer

Methods


<inner> getBuffer()

Gets the global buffer for the interest datastructure.
Returns:
buffer The interest buffer that should be set before running the interest determination.
Type
Dictionary

<inner> interest(interests, query, callback)

Calculates new interests given the search query and old interests.
Parameters:
Name Type Description
interests Array.<String> Old interests by the user that need to be updated.
query String The search query that the user has put in the search engine
callback function The callback that will be executed once interests are calculated with the new interests and an interest buffer that needs to be provided later.

<inner> maintainance()

Maintains the global interests array and the buffer object.

<inner> setBuffer()

Sets the global buffer for the interest datastructure.

<inner> wordextract(sentence)

Tags and extracts sentiment_categories from a given sentence.
Parameters:
Name Type Description
sentence String The sentence on which POS tagging needs to be done.
Returns:
The array of selected and filtered word after POSTagging.
Type
Array.<String>

<inner> wordtagger(sentence)

Tags and extracts pickup_categories from a given sentence.
Parameters:
Name Type Description
sentence String The sentence on which POS tagging needs to be done.