Repository navigation
fix: preserve sentiment for unseen negations - #24
Merged
techcsispit merged 1 commit intoOct 19, 2026
Merged
Conversation
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
force-pushed
the
fix/unseen-negation-sentiment
branch
from
October 19, 2026 08:33
31a5a77 to
afa7bf4
Compare
Contributor
Author
|
hi @techcsispit i have solved the issue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.