Update README.md

This commit is contained in:
Cardiff NLP 2020-11-12 19:23:21 +00:00
parent 8eacbc59c0
commit 34a6247c25
1 changed files with 9 additions and 9 deletions

View File

@ -6,15 +6,6 @@ To evaluate this and other models on Twitter-specific data, please refer to the
## Example of classification
# Preprocess text (username and link placeholders)
def preprocess(text):
new_text = []
for t in text.split(" "):
t = '@user' if t.startswith('@') and len(t) > 1 else t
t = 'http' if t.startswith('http') else t
new_text.append(t)
return " ".join(new_text)
```python
from transformers import AutoModelForSequenceClassification
from transformers import TFAutoModelForSequenceClassification
@ -24,6 +15,15 @@ from scipy.special import softmax
import csv
import urllib.request
# Preprocess text (username and link placeholders)
def preprocess(text):
new_text = []
for t in text.split(" "):
t = '@user' if t.startswith('@') and len(t) > 1 else t
t = 'http' if t.startswith('http') else t
new_text.append(t)
return " ".join(new_text)
# Tasks:
# emoji, emotion, hate, irony, offensive, sentiment
# stance/abortion, stance/atheism, stance/climate, stance/feminist, stance/hillary