Text Classification
Transformers
PyTorch
Safetensors
English
roberta
situation-entities
discourse-modes
clause-classification
narrativity
argumentation
text-embeddings-inference
Instructions to use BabakScrapes/disco-se-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use BabakScrapes/disco-se-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="BabakScrapes/disco-se-classifier")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("BabakScrapes/disco-se-classifier") model = AutoModelForSequenceClassification.from_pretrained("BabakScrapes/disco-se-classifier") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -15,13 +15,15 @@ base_model: roberta-base
|
|
| 15 |
|
| 16 |
# DiSCo Situation-Entity Classifier (18-way)
|
| 17 |
|
| 18 |
-
A `roberta-base` model fine-tuned to label an English **clause** with one of **18 Situation Entity (SE) types**
|
| 19 |
|
| 20 |
- **Genericity** of the main referent: `specific` / `generic`
|
| 21 |
- **Eventivity** of the main verb constellation: `dynamic` / `stative`
|
| 22 |
- **Boundedness/Habituality** of the eventuality: `static` / `episodic` / `habitual`
|
| 23 |
|
| 24 |
-
This is the SE-classification component of the DiSCo pipeline (the companion model is [`BabakScrapes/disco-clause-segmenter`](https://huggingface.co/BabakScrapes/disco-clause-segmenter), which splits raw text into clauses first).
|
|
|
|
|
|
|
| 25 |
|
| 26 |
## Label set
|
| 27 |
|
|
@@ -48,7 +50,7 @@ The model outputs 18 classes. The mapping to `(genericity, eventivity, boundedne
|
|
| 48 |
| 16 | NONSENSE | NA | NA | NA |
|
| 49 |
| 17 | OTHER | NA | NA | NA |
|
| 50 |
|
| 51 |
-
Classes 14–17 carry no attribute decomposition and are excluded from attribute-share calculations in the DiSCo analyses.
|
| 52 |
|
| 53 |
## Usage
|
| 54 |
|
|
@@ -63,12 +65,12 @@ clause = "my friend smoked marijuana daily"
|
|
| 63 |
enc = tok(clause, return_tensors="pt", truncation=True, max_length=128)
|
| 64 |
with torch.inference_mode():
|
| 65 |
pred_id = model(**enc).logits.argmax(-1).item()
|
| 66 |
-
print(model.config.id2label[pred_id])
|
| 67 |
```
|
| 68 |
|
| 69 |
## Training data
|
| 70 |
|
| 71 |
-
|
| 72 |
|
| 73 |
## Performance
|
| 74 |
|
|
@@ -83,14 +85,13 @@ Training-time validation performance (seed 42, random 10% validation):
|
|
| 83 |
|
| 84 |
The 18-way macro-F1 is depressed by severe class imbalance (the most frequent labels are ~10× more common than the rarest); the per-attribute metrics better reflect what downstream analyses consume.
|
| 85 |
|
| 86 |
-
**Note on evaluation.** These are *training-time validation* numbers. The
|
| 87 |
|
| 88 |
## Limitations
|
| 89 |
|
| 90 |
-
- English only
|
| 91 |
-
-
|
| 92 |
-
- Not a content/topic model — the features are formal and content-agnostic by design.
|
| 93 |
|
| 94 |
## Citation
|
| 95 |
|
| 96 |
-
Hemmatian, B. (2022). *
|
|
|
|
| 15 |
|
| 16 |
# DiSCo Situation-Entity Classifier (18-way)
|
| 17 |
|
| 18 |
+
A `roberta-base` model pre-trained on the SitEnt corpus (Friedrich, 2016) and then fine-tuned on the DiSCo corpus (Hemmatian, 2022; fortchoming) to label an English Elementary Discourse Unit (roughly a **clause**) with one of **18 Situation Entity (SE) types**. The labels are an extension of Smith's (2003) discourse-mode framework with Grisot (2018) boundedness (see Hemmatian, 2022, for details). Each SE label decomposes into three content-agnostic attributes used in downstream analyses:
|
| 19 |
|
| 20 |
- **Genericity** of the main referent: `specific` / `generic`
|
| 21 |
- **Eventivity** of the main verb constellation: `dynamic` / `stative`
|
| 22 |
- **Boundedness/Habituality** of the eventuality: `static` / `episodic` / `habitual`
|
| 23 |
|
| 24 |
+
This is the SE-classification component of the DiSCo pipeline (the precursor companion model is [`BabakScrapes/disco-clause-segmenter`](https://huggingface.co/BabakScrapes/disco-clause-segmenter), which splits raw text into clauses first).
|
| 25 |
+
|
| 26 |
+
See the [demos](https://huggingface.co/spaces/BabakScrapes/Anecedotal_Discourse_Classifier_Demo).
|
| 27 |
|
| 28 |
## Label set
|
| 29 |
|
|
|
|
| 50 |
| 16 | NONSENSE | NA | NA | NA |
|
| 51 |
| 17 | OTHER | NA | NA | NA |
|
| 52 |
|
| 53 |
+
Classes 14–17 carry no attribute decomposition per the definitions of the linguistic attributes and are excluded from attribute-share calculations in the DiSCo analyses.
|
| 54 |
|
| 55 |
## Usage
|
| 56 |
|
|
|
|
| 65 |
enc = tok(clause, return_tensors="pt", truncation=True, max_length=128)
|
| 66 |
with torch.inference_mode():
|
| 67 |
pred_id = model(**enc).logits.argmax(-1).item()
|
| 68 |
+
print(model.config.id2label[pred_id])
|
| 69 |
```
|
| 70 |
|
| 71 |
## Training data
|
| 72 |
|
| 73 |
+
Pre-trained on the SitEnt corpus, then fine-tuned on the **DiSCo corpus** clause annotations: opinionated, mixed-register English text (news from four outlets across the political spectrum, Reddit, and AI-generated text) primarily on the topic of marijuana legalization. This domain is deliberately harder and more varied than the Wikipedia-dominated SitEnt corpus on which prior SE classifiers were trained.
|
| 74 |
|
| 75 |
## Performance
|
| 76 |
|
|
|
|
| 85 |
|
| 86 |
The 18-way macro-F1 is depressed by severe class imbalance (the most frequent labels are ~10× more common than the rarest); the per-attribute metrics better reflect what downstream analyses consume.
|
| 87 |
|
| 88 |
+
**Note on evaluation.** These are *training-time validation* numbers. The released weights and corpus let you re-train and re-evaluate under any split you prefer.
|
| 89 |
|
| 90 |
## Limitations
|
| 91 |
|
| 92 |
+
- English only
|
| 93 |
+
- pre-trained on largely encyclopedic texts then tuned for opinionated, mixed-register text on one controversial policy topic. Performance on other genres may differ. However, as the features are formal and content-agnostic by design, good cross-genre generalization is expected.
|
|
|
|
| 94 |
|
| 95 |
## Citation
|
| 96 |
|
| 97 |
+
Hemmatian, B. (2022). *Taking the High Road: A Big Data Investigation of Natural Discourse in the Emerging U.S. Consensus about Marijuana Legalization*. Brown University. And the DiSCo corpus paper (forthcoming, *Behavior Research Methods*). See the [DiSCo demos](https://huggingface.co/spaces/BabakScrapes/Anecedotal_Discourse_Classifier_Demo).
|