# smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys architecture

> Architecture diagram of the GitHub repository smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys
- Repository: https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys

## Overview

This research project tests whether matching a reader’s recent emotional interests to article emotion improves news ranking. Its central workflow prepares MIND click histories and article text, derives article emotion features and reader-relative matches, compares rankers with and without those features, and evaluates paired results. The README documents additional validation, behavioral analyses, robustness controls, and reporting capabilities. Relationships are grounded in the README and shown source references; unsampled implementation details are represented only at supported subsystem level.

Main entry points: [`src/ranking/congruence.py`](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/ranking/congruence.py) (Reader profiles), [`src/evaluation/evaluate.py`](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/evaluation/evaluate.py) (Model evaluation), [`src/models/lightgbm_ranker.py`](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/models/lightgbm_ranker.py) (LightGBM ranker), [`src/data/mind.py`](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/data/mind.py) (MIND preparation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_data_prep["MIND preparation<br/>[mind.py]"]
  node_pipeline["Research pipeline<br/>[pipeline.py]"]
end

subgraph group_emotion["Emotion features"]
  node_emotion_scoring["GoEmotions scoring<br/>[goemotions.py]"]
  node_lexicon["NRC lexicons<br/>[lexicon.py]"]
  node_emotion_features["Article features"]
  node_emotion_validation["SemEval validation<br/>[semeval.py]"]
end

subgraph group_ranking["Ranking models"]
  node_profiles["Reader profiles<br/>[congruence.py]"]
  node_behavior["Behavior features<br/>[behaviour.py]"]
  node_baselines["Popularity and TF-IDF<br/>[baselines.py]"]
  node_sbert["Sentence-BERT ranker<br/>[sbert.py]"]
  node_lightgbm["LightGBM ranker<br/>[lightgbm_ranker.py]"]
  node_nrms["Neural NRMS ranker<br/>[nrms.py]"]
  node_fusion["Combined ranking<br/>[fusion.py]"]
  node_reranker["Emotion re-ranker<br/>[emotion_rerank.py]"]
end

subgraph group_evaluation["Evaluation"]
  node_evaluation["Model evaluation<br/>[evaluate.py]"]
  node_metrics["Ranking metrics<br/>[metrics.py]"]
  node_stats["Paired statistics<br/>[stats.py]"]
end

subgraph group_analysis["Research analyses"]
  node_click_signal["Click signal tests<br/>[click_signal.py]"]
  node_subgroups["Subgroup analysis<br/>[subgroups.py]"]
  node_story_charts["Results charts<br/>[story_charts.py]"]
end

node_researcher(("Researcher"))
node_mind[("MIND click data")]
node_results[("Experiment results")]

node_mind -->|"prepares data"| node_data_prep
node_data_prep -->|"supplies article text"| node_emotion_scoring
node_emotion_scoring -->|"scores text"| node_emotion_features
node_lexicon -->|"adds lexicon features"| node_emotion_features
node_emotion_features -->|"provides item vectors"| node_profiles
node_data_prep -->|"provides click history"| node_profiles
node_emotion_scoring -->|"validates scores"| node_emotion_validation
node_profiles -->|"provides match features"| node_lightgbm
node_profiles -->|"provides emotion match"| node_sbert
node_behavior -->|"provides behavior features"| node_lightgbm
node_baselines -->|"supplies baseline scores"| node_lightgbm
node_baselines -->|"provides baseline rankers"| node_sbert
node_profiles -->|"provides emotion match"| node_reranker
node_sbert -->|"reranks candidates"| node_reranker
node_nrms -->|"blends model scores"| node_fusion
node_lightgbm -->|"blends model scores"| node_fusion
node_lightgbm -->|"submits scores"| node_evaluation
node_evaluation -->|"computes metrics"| node_metrics
node_evaluation -->|"writes predictions and metrics"| node_results
node_evaluation -->|"compares model results"| node_stats
node_profiles -->|"tests congruence signal"| node_click_signal
node_click_signal -->|"tests significance"| node_stats
node_evaluation -->|"feeds subgroup analysis"| node_subgroups
node_results -->|"supplies chart results"| node_story_charts
node_researcher -->|"runs experiments"| node_pipeline
node_pipeline -->|"orchestrates steps"| node_data_prep
node_pipeline -->|"produces research outputs"| node_results

click node_data_prep "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/data/mind.py"
click node_emotion_scoring "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/emotion/goemotions.py"
click node_lexicon "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/emotion/lexicon.py"
click node_emotion_features "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/emotion/emotion_features.py"
click node_emotion_validation "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/emotion/semeval.py"
click node_profiles "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/ranking/congruence.py"
click node_behavior "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/ranking/behaviour.py"
click node_baselines "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/models/baselines.py"
click node_sbert "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/models/sbert.py"
click node_lightgbm "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/models/lightgbm_ranker.py"
click node_nrms "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/models/nrms.py"
click node_fusion "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/ranking/fusion.py"
click node_reranker "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/ranking/emotion_rerank.py"
click node_evaluation "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/evaluation/evaluate.py"
click node_metrics "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/evaluation/metrics.py"
click node_stats "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/evaluation/stats.py"
click node_click_signal "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/evaluation/click_signal.py"
click node_subgroups "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/evaluation/subgroups.py"
click node_story_charts "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/utils/story_charts.py"
click node_pipeline "https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/utils/pipeline.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_data_prep,node_pipeline toneBlue
class node_emotion_scoring,node_lexicon,node_emotion_features,node_emotion_validation,node_mind,node_results toneAmber
class node_profiles,node_behavior,node_baselines,node_sbert,node_lightgbm,node_nrms,node_fusion,node_reranker toneMint
class node_evaluation,node_metrics,node_stats toneRose
class node_click_signal,node_subgroups,node_story_charts,node_researcher toneIndigo
```

## Components

### Data preparation

- [MIND preparation](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/data/mind.py): `src/data/mind.py`
- [Research pipeline](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/utils/pipeline.py): `src/utils/pipeline.py`

### Emotion features

- [GoEmotions scoring](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/emotion/goemotions.py): `src/emotion/goemotions.py`
- [NRC lexicons](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/emotion/lexicon.py): `src/emotion/lexicon.py`
- [Article features](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/emotion/emotion_features.py): `src/emotion/emotion_features.py`
- [SemEval validation](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/emotion/semeval.py): `src/emotion/semeval.py`

### Ranking models

- [Reader profiles](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/ranking/congruence.py): `src/ranking/congruence.py`
- [Behavior features](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/ranking/behaviour.py): `src/ranking/behaviour.py`
- [Popularity and TF-IDF](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/models/baselines.py): `src/models/baselines.py`
- [Sentence-BERT ranker](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/models/sbert.py): `src/models/sbert.py`
- [LightGBM ranker](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/models/lightgbm_ranker.py): `src/models/lightgbm_ranker.py`
- [Neural NRMS ranker](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/models/nrms.py): `src/models/nrms.py`
- [Combined ranking](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/ranking/fusion.py): `src/ranking/fusion.py`
- [Emotion re-ranker](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/ranking/emotion_rerank.py): `src/ranking/emotion_rerank.py`

### Evaluation

- [Model evaluation](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/evaluation/evaluate.py): `src/evaluation/evaluate.py`
- [Ranking metrics](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/evaluation/metrics.py): `src/evaluation/metrics.py`
- [Paired statistics](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/evaluation/stats.py): `src/evaluation/stats.py`

### Research analyses

- [Click signal tests](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/evaluation/click_signal.py): `src/evaluation/click_signal.py`
- [Subgroup analysis](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/evaluation/subgroups.py): `src/evaluation/subgroups.py`
- [Results charts](https://github.com/smit-savaliya-dev/beyond-keywords-emotion-aware-rec-sys/blob/main/src/utils/story_charts.py): `src/utils/story_charts.py`

### Other components

- **Researcher**
- **MIND click data**
- **Experiment results**

## Connections

- MIND click data → MIND preparation: prepares data
- MIND preparation → GoEmotions scoring: supplies article text
- GoEmotions scoring → Article features: scores text (evidence: `src/emotion/emotion_features.py`)
- NRC lexicons → Article features: adds lexicon features (evidence: `src/emotion/emotion_features.py`)
- Article features → Reader profiles: provides item vectors
- MIND preparation → Reader profiles: provides click history
- GoEmotions scoring → SemEval validation: validates scores (evidence: `src/emotion/semeval.py`)
- Reader profiles → LightGBM ranker: provides match features (evidence: `src/models/lightgbm_ranker.py`)
- Reader profiles → Sentence-BERT ranker: provides emotion match (evidence: `src/models/sbert.py`)
- Behavior features → LightGBM ranker: provides behavior features (evidence: `src/models/ltr_v6.py`)
- Popularity and TF-IDF → LightGBM ranker: supplies baseline scores (evidence: `src/models/lightgbm_ranker.py`)
- Popularity and TF-IDF → Sentence-BERT ranker: provides baseline rankers
- Reader profiles → Emotion re-ranker: provides emotion match
- Sentence-BERT ranker → Emotion re-ranker: reranks candidates
- Neural NRMS ranker → Combined ranking: blends model scores
- LightGBM ranker → Combined ranking: blends model scores
- LightGBM ranker → Model evaluation: submits scores (evidence: `src/models/lightgbm_ranker.py`)
- Model evaluation → Ranking metrics: computes metrics (evidence: `src/evaluation/evaluate.py`)
- Model evaluation → Experiment results: writes predictions and metrics (evidence: `src/evaluation/evaluate.py`)
- Model evaluation → Paired statistics: compares model results (evidence: `src/evaluation/final_eval.py`)
- Reader profiles → Click signal tests: tests congruence signal (evidence: `src/evaluation/click_signal.py`)
- Click signal tests → Paired statistics: tests significance (evidence: `src/evaluation/click_signal.py`)
- Model evaluation → Subgroup analysis: feeds subgroup analysis (evidence: `src/evaluation/subgroups.py`)
- Experiment results → Results charts: supplies chart results
- Researcher → Research pipeline: runs experiments
- Research pipeline → MIND preparation: orchestrates steps
- Research pipeline → Experiment results: produces research outputs
