Skip to content

Preserve unavailable sentiment scores and improve local matching - #143

Open
J0s3f wants to merge 3 commits into
mlomb:mainfrom
J0s3f:fix/sentiment-matching-and-coverage
Open

J0s3f wants to merge 3 commits into
mlomb:mainfrom
J0s3f:fix/sentiment-matching-and-coverage

Conversation

@J0s3f

@J0s3f J0s3f commented Oct 8, 2026 •

Copy link
Copy Markdown

I used the tool on a mid size German Discord server and found a few issues. I fixed them:

Text messages without recognized sentiment terms currently serialize an unavailable score through NaN as byte zero. Both message readers turn that into -128, so an export with many unscored messages can appear overwhelmingly negative. This change preserves score availability through serialization and shows unscored coverage explicitly.

  • Reserve byte zero for unavailable sentiment, keep balanced zero distinct, and preserve the sign of fractional emoji scores. Both readers use the same decoder; the byte layout is unchanged.
  • Match words case-insensitively, consume the longest phrase once, and improve nearby negation with common German forms, a small set of dialect aliases, contrast boundaries and the not only / nicht nur exception. Matching no longer allocates a sliced token array at every word.
  • Include unscored messages in the overview and percentage denominators, show coverage, and use a non-interactive chart legend so small categories remain readable without changing the denominator.
  • Add regression coverage for serialization, both readers, complete database/report aggregation, phrase matching and negation. Document limitations and how to regenerate older standalone reports.
  • Improve the German word list for chat: ignore discourse particles that carried polarity ("ja", "bitte", "sicher"), treat price words as complaints, add common German/Austrian profanity and complaint words, and keep negated insults negative ("ned so deppat"). - This is a separate commit and can be removed, if only the bugfix is wanted.

Compatibility: legacy byte zero cannot distinguish an unavailable score from a genuine score saturated at -128. Regenerating from the export resolves that ambiguity. New valid scores clamp to [-127, 127].

J0s3f added 3 commits October 8, 2026 11:09
The German word list gave polarity to discourse particles and ordinary nouns
("ja", "bitte", "sicher", "Kinder", "Art"), so neutral or critical messages
scored as positive, while common profanity and complaints were missing.

- Ignore discourse particles and nouns that carry no sentiment of their own.
- Price words such as "teuer" are a complaint, not praise.
- Add frequent German and Austrian dialect profanity, insults, complaints and
  inflected positives that were missing.
- Insults and profanity are not reversed by nearby negation ("ned so deppat"
  stays negative).

Evaluated offline against model-labelled German chat: on messages with a
score, accuracy and coverage rose and polarity reversals fell. Regression
tests cover particles, new vocabulary and negated insults.
@J0s3f
J0s3f marked this pull request as ready for review October 8, 2026 12:36
Copilot AI balanced review requested due to automatic review settings October 8, 2026 12:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
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.

2 participants