Repository navigation
feat: sentiment & toxicity analysis, raid detection, and topic cloud extraction - #2706
Conversation
9c21454 to
372dba7
Compare
|
Sentiment and topic extraction are nice additions, but a few things need fixing before merging. Correctness
"Raid detection" Cost and robustness
Tests Thanks again! |
|
Addressed all review feedback in commit
|
|
Two things before merging:
Once the CI is green I'll merge it. Thanks! |
af1929b to
69734d7
Compare
|
Addressed both items in commit
|
…extraction
- src/sentiment_analyzer.py: Zero-dependency multilingual heuristic sentiment
and toxicity analyzer. Computes valence score (-1.0 to +1.0), toxicity index,
emoji polarity, CAPS LOCK/aggression detection, and flags coordinated raids.
- src/topic_extractor.py: Multilingual keyword and n-gram extractor with stopword
filtering; produces weighted topic clouds, bigrams, and hashtag frequencies.
- src/osint_service.py: Add analyze_sentiment() and extract_topics() methods.
- src/web/app.py: Add /api/target/{target}/nlp/sentiment and .../nlp/topics
endpoints secured with local origin checks.
- src/web/tools.py: Register analyze_sentiment and extract_topics tools.
- src/web/static/index.html: Add sentiment gauge cards, toxicity distribution
bars, flagged comments, and weighted topic cloud visualization.
- tests/test_sentiment_nlp.py: Test suite covering sentiment scoring, raid
detection, stopword filtering, n-grams, and API endpoints.
…traction - Use whole-word regex matching for toxic keywords to avoid substring false positives - Strip U+FE0F variation selector to correctly match emoji sequences like red heart - Clean lexicon duplicates, separate spam heuristics from toxicity score - Expand Italian and Spanish sentiment lexicon and comprehensive stopwords - Rename raid detection to hostility spike indicator with coordination analysis (repeat accounts/phrases) - Add investigative disclaimer in UI, doc/web-ui.md, and response payload - Server-side cap limit_posts (1-30) and comments per post (1-100) - Accurately report actual posts_scanned count and validate source parameter - Add tests for substring isolation, emoji sequence, Italian comments, organic controversy vs coordinated raids
69734d7 to
63184aa
Compare
|
Thanks for the rebase, it applies cleanly on One thing left before merging: the |
|
Removed both |
Overview
This PR introduces NLP capabilities to Osintgram with zero external dependencies:
src/sentiment_analyzer.py): Computes valence scores (-1.0 to +1.0), toxicity ratings (0–100%), and flags coordinated comment raids / brigading.src/topic_extractor.py): Cleans post captions and comments, filters multilingual stopwords, and generates weighted topic clouds, bigrams, and hashtag frequencies.1. Sentiment & Toxicity Analyzer (
src/sentiment_analyzer.py)???,!!!), abusive phrase matching, and crypto/forex promotional spam.2. Topic & N-gram Cloud Extractor (
src/topic_extractor.py)@mentions, and emojis while retaining core keywords.3. Service, Tools & UI
analyze_sentiment()andextract_topics()added toOsintgramService.analyze_sentimentandextract_topicsregistered for AI and manual modes.POST /api/target/{target}/nlp/sentimentPOST /api/target/{target}/nlp/topics_require_local_originon all endpoints.Verification & Testing
tests/test_sentiment_nlp.pycovering sentiment scoring, toxicity heuristics, raid detection, stopword filtering, n-grams, and API endpoints.