Skip to content

marble‐processor‐simple

Miguel Fernandes edited this page Apr 29, 2017 · 7 revisions

Type

Processor.

Function

This processor assigns a polarity value to each message related to a specific topic.

To calculate this value, it uses a bag-of-words approach, based on the senticnet 3 corpus. The steps performed are the following:

  1. The message is split into sentences, using the following regular expression as delimiter: [\\.,;!?].
  2. For each sentence, groups of 4 to 1 words are created, and looked up in the senticnet corpus to get the polarity value.
  3. If the word previous to a group matches no[t]?, the result is reversed.
  4. All polarity values are added up, and represent the polarity of the sentence.
  5. The total polarity of a message is the average of all the sentence's polarities.

Usage

Requirements

The senticnet corpus needs to be loaded into marble before the first time use of this processor.

  1. Download the corpus here, in its xml version.
  2. Load it sending a POST request to the url:
http://<server>:<port>/api/update_senticnet

with a single parameter called file with the corpus contents.

Options

ignoreNeutralSentences: Ignores sentences with neutral (0) polarity in the average calculation.

Example Recipe

{
  "name": "processor-simple",
  "options": {
    "ignoreNeutralSentences": true
  }
}