How to Do Sentiment Analysis in KNIME on Facebook

Cody Schneider8 min read

Want to know how people really feel about your brand on Facebook? Going beyond likes and shares to understand the emotion behind comments is where you'll find game-changing insights. This guide will walk you through setting up a sentiment analysis workflow in KNIME to automatically categorize your Facebook comments as positive, negative, or neutral.

GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

What is Sentiment Analysis?

Sentiment analysis is a way to use text analytics to determine the emotional tone behind a piece of writing. For a business, this means you can automatically classify a customer comment, review, or social media post as positive, negative, or neutral. Instead of manually reading thousands of comments to get a "gut feel" for audience reaction, you can process that data at scale to get a measurable big-picture view.

On a platform like Facebook, where users comment on everything from ad campaigns to product announcements and customer service posts, sentiment analysis helps you:

  • Gauge campaign reception: See if the comments on your latest ad are celebratory or complaining.
  • Track brand health: Monitor your overall brand perception over time. Are conversations becoming more positive?
  • Identify customer frustrations: Quickly find negative comments to address product issues or service problems before they escalate.
  • Find passionate brand advocates: Pinpoint your happiest customers by looking for highly positive comments.

Using a tool like KNIME, you can build a reusable system to do this analysis for you, saving countless hours of manual work.

Getting Started: Your KNIME Toolkit

KNIME Analytics Platform is a free, open-source tool for data science and analysis. It uses a visual, drag-and-drop interface where you connect different processing steps (called "nodes") to build a workflow. It’s perfect for this kind of text analysis without needing to write a single line of code.

Before you build the workflow, you’ll need a few essential extensions. If you don't already have them, you can install them easily.

In KNIME, navigate to File → Install KNIME Extensions…

In the window that appears, search for and install the following packages:

  • KNIME Textprocessing: This is the core engine for all text-based analysis, providing the nodes needed to clean and prepare your comments.
  • KNIME Interactive Csv Editor: A helpful tool for working with CSV files.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

A Quick Note on Getting Facebook Data

Years ago, you could directly connect to Facebook with dedicated KNIME nodes. However, due to API changes and privacy policies, this direct connection is no longer reliable. The most practical and stable method today is to work with an exported file of your Facebook data.

You can typically export comments from a specific post or date range directly from Facebook's Business Suite or Meta's Creator Studio. Alternatively, many social media management tools like Hootsuite or Sprout Social allow you to export comment data as a CSV file. For this tutorial, we will assume you have a CSV file with at least one column containing the text of the Facebook comments.

Building Your Sentiment Analysis Workflow: Step-by-Step

With KNIME open and your CSV file ready, it's time to build the workflow. We’ll add and configure each node one by one. Our workflow will look something like this in the end: File Reading → Text Preprocessing → Sentiment Analysis → Results Aggregation.

Step 1: Reading Your Data

First, we need to bring our Facebook comments into KNIME.

Node: CSV Reader

Find the CSV Reader node in the Node Repository (the search bar on the left panel) and drag it onto your blank workflow canvas.

  • Configuration: Double-click the node to open its configuration window. Click "Browse..." and select your CSV file of Facebook comments. KNIME is usually smart enough to automatically detect the column headers and settings. If your comments are in a column named comment_text, make sure you see it in the preview panel. Click "OK" to close the window.
  • After running the node (right-click and select "Execute" or press F7), you'll see a green light under it, indicating the data has been loaded successfully.
GraphedGraphed

Build AI Agents for Marketing

Build virtual employees that run your go to market. Connect your data sources, deploy autonomous agents, and grow your company.

Watch Graphed demo video

Step 2: Preprocessing the Text for Analysis

Raw text from the internet is messy. It contains punctuation, uppercase and lowercase letters, emojis, and common "stop words" (like "the," "is," "a") that don't add much meaning. We need to clean this up so the sentiment analysis algorithm can focus on the important words.

Connect the output of your CSV Reader node to the input of the first node in this chain.

Node 1: String to Document

This node converts our text column into a special "Document" format that the text processing nodes can work with.

  • Configuration: Double-click the node. Select the column containing your comment text from the dropdown menu. Keep the other settings as default and click "OK." Execute the node.

Node 2: Case Converter

This standardizes all text to lowercase. This is important because "Love" and "love" should be treated as the same word.

  • Configuration: Inside the node's settings, simply make sure the "Convert to lower case" option is selected. Run the node.

Drag an arrow from the output of the String to Document node to the input of the Case Converter node to connect them.

Node 3: Punctuation Erasure

This node removes commas, periods, exclamation marks, etc. These characters are not needed for sentiment scoring.

  • Configuration: This node usually requires no specific setup. Just connect it, check the default settings, and run it.

Node 4: Stop Word Filter

Here, we remove common words that don’t carry sentiment. KNIME comes with a built-in list of stop words for English.

  • Configuration: Open the node. Check that the built-in "English" list is selected. You can also add your own custom words to the list on the right if you find words specific to your brand that you want to exclude. Leave the other settings and run it.

Node 5: Snowball Stemmer

Stemming reduces words to their root form (e.g., "complaining," "complained," and "complains" all become "complain"). This helps the algorithm recognize related words as a single concept.

  • Configuration: No special setup is needed here. Connect it to the chain and execute it.

At this point, you have a solid preprocessing chain that turns messy comments into clean, standardized text perfect for analysis.

Step 3: Calculating the Sentiment

Now for the main event. We will use a node that contains a "dictionary" of words that are pre-labeled as positive or negative. The node will scan our processed text, count the positive and negative words in each comment, and then assign a sentiment value.

Node: Dictionary Tagger (PMI)

There are a few ways to do this in KNIME, but the Dictionary Tagger (PMI) node is a great and versatile option. It comes pre-loaded with a list for sentiment analysis.

Connect the output of your Snowball Stemmer node to the input of this one.

  • Configuration: Double-click the node. In the "Dictionary" dropdown, select "Sentiment." In the "Tag type values" section, check "positive" and "negative." This tells the node to look for words that match either of these categories in its built-in dictionary. Click "OK" and execute the node.

The output of this node will now include new columns named after the categories in the dictionary (positive, negative). Each row (representing a single comment) shows a 1 if a word from the category tag was found and 0 if not.

Free PDF · the crash course

AI Agents for Marketing Crash Course

Learn how to deploy AI marketing agents across your go-to-market — the best tools, prompts, and workflows to turn your data into autonomous execution without writing code.

Step 4: Making Sense of the Results

We've tagged our data, but now we need to summarize it to get our final count. A GroupBy node is perfect for this.

Node: GroupBy

This node will count how many comments were tagged as positive and how many were tagged as negative.

  • Configuration:

You now have a table with your final results — a total count of positive and negative comments!

Bonus: Visualizing the Results

To visualize the results quickly, add a Bar Chart node after the GroupBy node.

  • Configuration: Open the node settings. For the "Category Column," select positive and negative. Give the chart a title, and execute the view.

And that's it! You've successfully built a workflow that can automatically analyze sentiment from your Facebook comment exports.

Final Thoughts

Building a sentiment analysis workflow in KNIME puts powerful social media analytics directly into your hands. By preprocessing text and tagging it based on sentiment dictionaries, you can turn a file of disorganized comments into a clear, measurable report on audience perception without any manual effort.

While workflows in platforms like KNIME are incredibly powerful, they still involve downloading CSVs, configuring nodes, and managing the workflow itself. As we build Graphed, our goal is to eliminate that friction entirely. By connecting directly to your marketing data sources, we allow you to run the same kind of analysis — like gauging campaign sentiment or tracking brand conversations — just by asking a simple question in plain English, giving you back hours of time to focus on strategy instead of setup.

Related Articles