From 34a6247c25a233a1e9a1701d6e72ff04cd9a369e Mon Sep 17 00:00:00 2001 From: Cardiff NLP Date: Thu, 12 Nov 2020 19:23:21 +0000 Subject: [PATCH] Update README.md --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 985c51d..dd252ff 100644 --- a/README.md +++ b/README.md @@ -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