-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Add a sentiment analysis step to classify each normalized article as positive/neutral/negative.
Motivation
- Enables tracking of sentiment trends for entities and topics over time.
- Supports alerting on sudden sentiment shifts (e.g. negative spikes).
Scope
In scope: implementation, tests
Acceptance Criteria
-
analyze_sentiment(text)returns a non-emptylabeland numericscore. -
sentiment_task(article_id)stores a"sentiment"field on the article. - CLI command runs without errors and prints the sentiment result.
- All tests pass in CI and README clearly documents both execution paths.
Additional Context
- Add dependencies
- Add
transformersandtorchto/nlp/requirements.txt.
- Add
- Core function signature
- In
/nlp/core.pydefine:def analyze_sentiment(text: str) -> dict
- In
- Celery task hook
- In
/nlp/tasks.pyregister:@app.task def sentiment_task(article_id: str) -> dict
- In
- CLI entrypoint
- In
/nlp/cli.pyexpose:python -m nlp.cli sentiment --article-id=<id>
- In
- Tests & docs
- Create
/nlp/tests/test_sentiment.pyto:- Assert
analyze_sentiment()returns a dict withlabelandscore. - Assert
sentiment_task()updates the article document with a"sentiment"field.
- Assert
- Update
/nlp/README.mdwith:- How to run
sentiment_taskvia Celery - CLI usage for the
sentimentcommand
- How to run
- Create
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Ready