CoolFace
Apppublic

sampstad/narrative_detector

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
App README

๐Ÿ“ฐ Narrative Extractor

Extract the key narrative elements from any news article or paragraph โ€” who, what, when, where, and why โ€” with semantic thread clustering to separate distinct storylines.

What it extracts

SectionMethod
SummaryExtractive (top-2 entity-rich sentences)
ToneDistilBERT (distilbert-base-uncased-finetuned-sst-2-english)
People / Orgs / PlacesspaCy NER (en_core_web_lg) + FastCoref coreference
Time referencesspaCy DATE/TIME entities + dateparser normalisation
Key actionsSubject-Verb-Object triples from dependency parse
Causal linksRegex on connectives with confidence scores
Narrative threadsall-MiniLM-L6-v2 embeddings + HDBSCAN clustering

Run locally

bash
pip install -r requirements.txt
python app.py

Project structure

narrative_HF/
โ”œโ”€โ”€ app.py            # Streamlit UI
โ”œโ”€โ”€ pipeline.py       # NLP extraction logic
โ”œโ”€โ”€ requirements.txt  # Python dependencies
โ””โ”€โ”€ .streamlit/
    โ””โ”€โ”€ config.toml   # Theme configuration