Skip to main content
Skip to main content

Can a computer recognise your sentiment?

Integrating Digital Technologies
Years 5-6

DT+ English

This lesson plan enables students to explore how Natural Language Processing (NLP), a subset of Artificial Intelligence (AI), is used to assess and categorise a user’s online comments. (AI is the ability of machines to mimic human capabilities in a way that we would consider 'smart'.)

Before booking a service or buying a product online, many people read online reviews of them as a way of checking quality and whether others recommend them.

With the emergence of AI systems, NLP enables users to get a summary of all the reviews of a product or service. The NLP categorises the text in each online review as positive, neutral or negative, which leads to an overall classification as positive, neutral or negative. Users benefit from the huge amounts of data that the NLP can process. Imagine having to read all the reviews to get an overall feeling about a product or service?

This lesson can be integrated with English; in particular, the use of evaluative language and synonyms.

This lesson was developed by the Digital Technologies Institute in collaboration with DT Hub.


Decorative image

Image credit: Pixaline/ pixabay

Suggested steps

Unplugged activity

This task explores systems that use NLP to classify a reviewer’s online text as positive, neutral or negative, based on words that might appear in the text. This is often referred to as ‘sentiment analysis’.

  1. Provide a range of online reviews for students to view and decide if they are positive, neutral or negative. What words provide students with that overall impression?
  2. Provide students with the worksheet, Positive, neutral or negative.
    • Task 1 asks the students to classify words as positive, neutral or negative.
    • Task 2 asks students to write and share a review, with their partner working out if the overall impression of the review is positive, neutral or negative.


Sentiment analyses aren’t always reliable. When training an AI, words and combinations of words would be classified as positive, neutral or negative through the process of supervised learning. Supervised learning is the process of the human providing the program with lots of examples of what it is we are wanting it to identify along with a label.

What combinations of words may produce an inaccurate sentiment analysis?


  1. A negative word combined with a positive word, ie no good, don’t like, not bad, etc.
  2. A paragraph that contains both positive and negative words.

Plugged activity

Use these suggested activities to explore NLP and sentiment analysis.

The activity has been levelled to enable differentiation.


Have students share what they have learned about AI and how ‘smart’ a computer can be.

  1. Look at how the AI tool worked, compared with the program you created in Scratch.
  2. Could your program be improved to better mimic AI?
  3. How might companies use sentiment analysis to help them provide a useful service for their customers?

Why is this relevant

This lesson focuses on:

  • text recognition
  • text classification.

Algorithms and programming are essential to developing machines powered by AI.

In conventional programming, the computer is provided with a set of instructions for a defined set of scenarios. In this lesson, students hardcode a program that is based on identifying a word contained in the user’s input (string). If that word is recognised, then a particular response is given. Else provides a generic response.

The downside with this programming is that every possible option needs to be hardcoded to ensure the text is correctly categorised. Also, the order that the word appears in the text affects the categorising. In an AI, a similar problem arises. We need to teach the AI each individual word, however the AI is good at solving all sorts of word combinations. So, we really want to point out that the conventional programming method struggles with the myriad of possible word combinations. An AI-based tool using NLP is better able to provide a correct categorisation as it has been trained on large amounts of data.