Skip to content

fix: preserve sentiment for unseen negations - #24

Merged
techcsispit merged 1 commit into
techcsispit:mainfrom
vivek-3728:fix/unseen-negation-sentiment
Oct 19, 2026
Merged

techcsispit merged 1 commit into
techcsispit:mainfrom
vivek-3728:fix/unseen-negation-sentiment

Conversation

@vivek-3728

Copy link
Copy Markdown
Contributor

Fixes #21

Closes #21

What I changed

Added inference support for negated words whose exact not_ token was not seen during training.
Preserved learned probabilities when an exact negated token exists.
Added regression tests for known positive and negative words, unseen negations, and exact-token precedence.

How it works

During prediction, the model first uses the learned probability when the exact token exists in the vocabulary. For an unseen negated token such as not_delicious, it now derives sentiment evidence from the known base word (delicious) using the probabilities associated with the opposing label instead of silently discarding the token.
This preserves the sentiment reversal introduced by negation while ensuring explicitly learned negated tokens still take priority over the fallback behavior.

@techcsispit

Copy link
Copy Markdown
Owner

The fix looks good. #23 is merged and it touches the same spot in tests/test_mess_mood.py. Please rebase onto main and keep both sets of tests. After that this is ready to merge.

@vivek-3728
vivek-3728 force-pushed the fix/unseen-negation-sentiment branch from 31a5a77 to afa7bf4 Compare October 19, 2026 08:33
@vivek-3728

Copy link
Copy Markdown
Contributor Author

hi @techcsispit i have solved the issue

@techcsispit
techcsispit merged commit 3c055a5 into techcsispit:main Oct 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Negation loses sentiment information for words not seen in training

2 participants