How niez233/hadsf works
Purpose and execution surface
HADSF implements a two-stage pipeline for explainable recommendation: derive a controlled, domain-specific aspect vocabulary, then extract history-aware aspect–opinion signals from reviews for recommendation modeling. The repository is script-oriented rather than a deployed service. Likely runnable entry points are aspect_extract/example.py, aspect_extract/extract_aspect_raw.py, aspect_extract/extract_review.py, model/ANR/model_run.py, and model/tgnn/model_run.py.
Stage I: controlled aspect vocabulary
Raw review text is processed into candidate aspects, then consolidated into the compact vocabulary A*. aspect_extract/extract_aspect_raw.py is the raw aspect-extraction stage; aspect_extract/extract_review.py appears to manage review-level extraction/processing. aspect_extract/example.py provides an example orchestration surface. This stage establishes the semantic control boundary consumed by later extraction and modeling.
Hallucination/semantic-quality evaluation
Two standalone evaluators quantify adherence to the controlled semantics:
• Aspect Drift Rate (ADR), implemented in aspect_extract/ADR.py, measures whether generated/extracted aspects deviate from A*.
• Opinion Fidelity Rate (OFR), implemented in aspect_extract/OFR.py, measures whether opinions remain semantically grounded in the source review.
These scripts form a quality boundary between extraction outputs and downstream recommendation inputs.
Stage II: dynamic review and preference processing
The second stage uses user–item interaction/review history to produce fine-grained aspect-aware representations and update preferences over time. The TGNN pipeline’s ingestion and graph-data preparation are centered in model/tgnn/load_data.py and model/tgnn/rhg_data.py. NLP preparation utilities reside in model/tgnn/nlp_util.py, while model/tgnn/util.py likely provides shared pipeline support.
Temporal/relational graph recommendation model
The principal dynamic model is implemented by relational history graph components: model/tgnn/rhgc.py and aspect-specific model/tgnn/rhgc_aspect.py. These consume prepared historical user/item/review/aspect signals and encode their evolving relationships. model/tgnn/model_run.py is the training/evaluation execution boundary for this model family.
Embedding semantic layer
BERT-based embedding normalization/whitening supports semantic comparison or model inputs: model/tgnn/bert_whitening.py handles general text embeddings, and model/tgnn/bert_whitening_aspect.py handles aspect-oriented embeddings. This is the likely bridge from text/aspect extraction to dense representations used by clustering, fidelity evaluation, or graph modeling.
Alternate recommendation baseline/model path
model/ANR/model_run.py supplies a separate ANR model execution path, likely for comparison or an alternative recommendation architecture. It is isolated from the TGNN directory, implying independently prepared inputs and runs rather than a shared end-to-end runtime.
Runtime and external dependencies
The project is Python-based. The only explicit dependency manifest is model/tgnn/requirements.txt; BERT references imply a pretrained language-model/embedding runtime, while the README points to a Google Drive-hosted processed dataset. No API server, database, scheduler, or cloud deployment infrastructure is represented in the tree.
Main entry points: extract_review.py Review processing · rhg_data.py Relational history graph data · nlp_util.py NLP preparation · load_data.py TGNN data loading
Components 18
Stage I · Aspect Extraction
Builds the controlled aspect vocabulary and review signals.
- Raw review text
- Raw aspect extraction
aspect_extract/extract_aspect_raw.py - Review processing · Produces review-level aspect–opinion signals.
aspect_extract/extract_review.py - Controlled vocabulary A* · Compact domain-specific aspect vocabulary.
- Extraction example · Example orchestration for Stage I.
aspect_extract/example.py
Semantic Quality
Standalone checks for extraction quality.
- Aspect Drift Rate · Measures aspect deviation from A*.
aspect_extract/ADR.py - Opinion Fidelity Rate · Checks whether opinions are grounded in reviews.
aspect_extract/OFR.py
Stage II · TGNN
Prepares temporal review histories and trains the graph recommender.
- Processed interaction data · External processed dataset with user–item review history.
- TGNN data loading
model/tgnn/load_data.py - NLP preparation
model/tgnn/nlp_util.py - Text embeddings · BERT-normalized semantic representations.
model/tgnn/bert_whitening.py - Aspect embeddings · BERT-normalized aspect representations.
model/tgnn/bert_whitening_aspect.py - Relational history graph data · Builds temporal user, item, review, and aspect relations.
model/tgnn/rhg_data.py - Relational history encoder · Encodes evolving user–item–review relationships.
model/tgnn/rhgc.py - Aspect history encoder · Encodes aspect-specific relational histories.
model/tgnn/rhgc_aspect.py - TGNN train and evaluate
model/tgnn/model_run.py - TGNN dependencies
model/tgnn/requirements.txt
Alternate Model
- ANR train and evaluate · Independent alternate recommendation path.
model/ANR/model_run.py
Connections 24
- Raw review text → Raw aspect extraction: extract candidates
- Raw aspect extraction → Controlled vocabulary A*: consolidate
- Raw review text → Review processing: process reviews
- Controlled vocabulary A* → Review processing: constrain aspects
- Extraction example → Raw aspect extraction: orchestrates
- Extraction example → Review processing: orchestrates
- Controlled vocabulary A* → Aspect Drift Rate: reference vocabulary
- Review processing → Aspect Drift Rate: evaluate aspects
- Raw review text → Opinion Fidelity Rate: source reviews
- Review processing → Opinion Fidelity Rate: evaluate opinions
- Processed interaction data → TGNN data loading: load histories
- Review processing → NLP preparation: aspect–opinion signals
- TGNN data loading → NLP preparation: review text
- NLP preparation → Text embeddings: embed text
- NLP preparation → Aspect embeddings: embed aspects
- TGNN data loading → Relational history graph data: interaction history
- Text embeddings → Relational history graph data: text features
- Aspect embeddings → Relational history graph data: aspect features
- Relational history graph data → Relational history encoder: temporal relations
- Relational history graph data → Aspect history encoder: aspect relations
- Relational history encoder → TGNN train and evaluate: user/item representations
- Aspect history encoder → TGNN train and evaluate: aspect representations
- TGNN dependencies → TGNN train and evaluate: runtime dependencies
- Processed interaction data → ANR train and evaluate: independent inputs