Negation with "not" and "no" is ignored during sentiment analysis

Closed Beginner friendly
#11 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@vivek-3728 is already working on this.

Since Oct 7, 2026.

  • #12 by @vivek-3728 — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python

Research direction

Read the README’s description of negation, then trace where stopwords are removed and where negation is handled during tokenization. Try the reported pairs (fresh/not fresh and stale food/no stale food); done means the negation words are not discarded before they can affect the sentiment result.

Written by the indexing model from the issue text.

Description

I noticed that sentences using not or no are being interpreted the same
way as sentences without the negation.

For example:

fresh
and
not fresh

both get tokenized as:

["fresh"]

and end up producing the same positive prediction.

The same thing happens with:

stale food
and
no stale food

According to the README, not, no, and never should negate the word that
comes after them, so I expected these inputs to affect the sentiment result.

It looks like not and no are included in the stopword list and get removed
before the negation logic gets a chance to process them. Because of this,
phrases like not delicious can be interpreted exactly like delicious,
which can result in the opposite sentiment from what the user intended.

Dominant language
Python
Stars
0
Forks
3
Avg merge
1d 9h
Merged PRs (30d)
13

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from techcsispit/mess-mood

All issues in techcsispit/mess-mood

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.