Skip to content

Sentiment analysis service

Danger

This tutorial is out of date. Please check the tutorials overview for our latest tutorials.

In this part of the tutorial you learn about the sentiment analysis service.

This service uses the Hugging Face model to calculate sentiment for messages, and these are then displayed on the web UI.

There are three deployed services here:

  1. Chat sentiment analysis
  2. Drafts sentiment analysis
  3. Twitch sentiment analysis

💡 Key ideas

The key ideas on this page:

  • Hugging Face model is used to generate sentiment values
  • How to examine message formats

What it does

The sentiment analysis service uses a prebuilt model from Hugging Face to analyze the sentiment of each message flowing through the service.

Draft messages are messages while the user is typing them, before they are sent. These are used to generate sentiment while the user is typing.

Both the messages and draft messages are generated by the web UI.

The sentiment analysis service subscribes to the chat-messages topic and performs sentiment analysis using the Hugging Face model, publishing a sentiment value to the chat-with-sentiment topic.

The drafts sentiment analysis service performs sentiment analysis on messages published to the drafts topic and publishes sentiment values to the drafts_sentiment topic.

The UI subscribes to these topics, and can then display the sentiment values in the UI.

👩‍🔬 Lab - Examine messages

There are several ways to view live data. This lab shows one way to do it.

  1. Click on Topics in the main left-hand navigation.

  2. Where you see live data for the chat-messages topic, click in that area, as shown in the screenshot:

    View live data

    You are taken to the live view of the Quix Data Explorer.

  3. The chat-messages topic is preselected for you. The stream names are the user names that you entered, or are user names from the Twitch service. Select any one and then select the chat-message parameter.

  4. Click the Messages view, and then click on any real-time message displayed. In the message code view you see something similar to the following:

    {
    "Epoch": 0,
    "Timestamps": [
        1695303751958000000
    ],
    "NumericValues": {},
    "StringValues": {
        "chat-message": [
        "Can you check on my order please?"
        ]
    },
    "BinaryValues": {},
    "TagValues": {
        "room": [
        "channel"
        ],
        "name": [
        "gabbybe"
        ],
        "role": [
        "Customer"
        ]
    }
    }
    

🏃‍♀️ Next step

Part 5 - Explore the Twitch service