Icon

04.Callee Deploying Sentiment Predictor - Lexicon Based

Deploying Sentiment Analysis Predictive Model - Lexicon Based Approach

This worflow applies the lexicon based approach on new tweets to predict their sentiment. The last component visualizes (1) the bar chart with the number of negative/positive/neutral tweets, (2) the word cloud of all collected tweets, and (3) the table with all collected tweets.

If you use this workflow, please cite:
F. Villaroel Ordenes & R. Silipo, “Machine learning for marketing on the KNIME Hub: The development of a live repository for marketing applications”, Journal of Business Research 137(1):393-410, DOI: 10.1016/j.jbusres.2021.08.036.

Annotations and comments
  • Callable Version of "Deploying Sentiment Analysis Predictive Model - Lexicon Based Approach" This callable version of our deployment workflow is useful for application testing, among other things.
  • 1. Receive text as input for sentiment prediction. Here we receive documents (e.g., tweets) to predict their sentiment. The only requirement is that the documents table should have a column named 'text'.
  • 2. Data Manipulation/Preparation. Here we execute a captured workflow segment of the building workflow that performs some data preprocessing. The most important node in this segment is "Strings to Document", which formats several string columns into a single document that can be text-mined in KNIME.
  • 3. Use Text Mining to Tag Words with Positive and Negative Meaning based on a Dictionary. Here we execute another captured segment of the building workflow -- this time, to tag words based on their sentiment. Non-tagged words get filtered out in the end.
  • 4. Count the Number of Positive and Negative Words per Document. Here we re-use a shared component also present in the building workflow. It encapsulates the counting of sentiment words per document, separated by class.
  • 5. Calculate a Sentiment Score based on the Number of Positive and Negative Words and Classify Documents based on the Score. The sentiment score is calculated by (number of postive words - number of negative words) divided by (number of postive words + number of negative words). If the score is negative it is classified as negative, if the score is positive it is classified as positive, and if it is equal to 0 it is classified as neutral.
  • 6. Get Original Data and Joined Sentiment Predictions. Here we execute a segment of the building workflow that joins the original data with joined predictions, when they exist. Recall that if a tweet/document does not have any sentiment word, it will have a neutral sentiment prediction associated with it. The quality of these predictions can then be evaluated by using this dataset in a web application or in a web service. Here, we send the output back for testing purposes.
  • Predict sentiment based on score (#Positive-#Negative)/ (#Positive+#Negative)
  • Create id column
  • Convert strings to to documents
  • Extract documents' source (RowID) to join them with original data
  • Join data with sentiment predictions and original data
  • Assign 'neutral' to documents with no sentiment tags. Also, assign a sentiment score of 0.0 to them.
  • Filtered words
  • By documents via sentiments
  • TF absolute
  • MPQA Dictionary
  • keep only tagged words

Nodes

Extensions

Links