Fast binary classifier that detects whether text contains propaganda techniques.
The binary detector serves as a fast filter with high recall, passing flagged content to the more detailed technique classifier.
1from transformers import pipeline
2
3detector = pipeline(
4 "text-classification",
5 model="synapti/nci-binary-detector"
6)
7
8text = "The radical left is DESTROYING our country!"
9result = detector(text)[0]
10
11print(f"Label: {result['label']}") # 'has_propaganda' or 'no_propaganda'
12print(f"Confidence: {result['score']:.2%}")
1from transformers import pipeline
2
3# Stage 1: Binary detection
4detector = pipeline("text-classification", model="synapti/nci-binary-detector")
5
6# Stage 2: Technique classification (only if propaganda detected)
7classifier = pipeline("text-classification", model="synapti/nci-technique-classifier", top_k=None)
8
9text = "Your text to analyze..."
10
11# Quick check first
12detection = detector(text)[0]
13if detection["label"] == "has_propaganda" and detection["score"] > 0.5:
14 # Detailed technique analysis
15 techniques = classifier(text)[0]
16 detected = [t for t in techniques if t["score"] > 0.3]
17 for t in detected:
18 print(f"{t['label']}: {t['score']:.2%}")
19else:
20 print("No propaganda detected")
1@inproceedings{da-san-martino-etal-2020-semeval,
2 title = "{S}em{E}val-2020 Task 11: Detection of Propaganda Techniques in News Articles",
3 author = "Da San Martino, Giovanni and others",
4 booktitle = "Proceedings of SemEval-2020",
5 year = "2020",
6}
7
8@misc{nci-binary-detector,
9 author = {NCI Protocol Team},
10 title = {NCI Binary Detector},
11 year = {2024},
12 publisher = {HuggingFace},
13 url = {https://huggingface.co/synapti/nci-binary-detector}
14}