PII-Aware Sentiment & Topic Pipeline
An end-to-end NLP system that classifies product feedback by sentiment and topic, redacts PII before any transformer sees the text, and corrects for sarcasm — a failure mode transformer sentiment models systematically miss. Same InferencePipeline instance powers both the REST API and the UI; no logic forks between surfaces. Architecture flowchart LR T["Raw feedback text"] --> R["Redaction(8 PII categories)"] R --> P["Preprocessing(lowercase, URL/mention strip)"] P --> S["Sentiment(RoBERTa 3-class)"] P --> TC["Topic(keyword classifier)"] S --> SA["Sarcasm Adjustment(regex + heuristics)"] SA --> RES["Structured resultsentiment + topic + confidences+ redaction_summary + latency"] TC --> RES RES --> API["FastAPIPOST /predict"] RES --> UI["Streamlit UI"] Each stage is an independently testable component and can be swapped at runtime via constructor injection. replace_* methods on InferencePipeline allow hot-swapping any stage without rebuilding — useful for A/B comparisons and evaluation harnesses. ...