Downloads · 30 days
2
0% of all-time downloads
faizaulia/e5-fine-tune-polri-news-emotion
e5-fine-tune-polri-news-emotion is a text classification model from faizaulia. Use it when you need a label for a piece of text. It is set up for transformers.
This model is a fine-tuned model of , trained with Indonesian police news data.
Downloads · 30 days
2
0% of all-time downloads
All-time downloads
15.3K
Public
Parameters
560M
4.5 GB on disk
Likes
0
Public
Click a slice to open those files.
.bin2.2 GB · 50%
From the Hugging Face model README
This model is a fine-tuned model of intfloat/multilingual-e5-large, trained with Indonesian police news data.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("faizaulia/e5-fine-tune-polri-news-emotion")
model = AutoModelForSequenceClassification.from_pretrained("faizaulia/e5-fine-tune-polri-news-emotion")
0: Angry, 1: Fear, 2: Sad, 3: Neutral, 4: Happy, 5: Love
LAMPUNG, KOMPAS.com - Komplotan perampok yang menyekap satu keluarga di Kabupaten Lampung Timur ditembak aparat kepolisian. Komplotan ini menggondol uang sebanyak Rp 50 juta milik korban. Kapolres Lampung Timur, AKBP M Rizal Muchtar mengatakan, tiga dari empat pelaku ini telah ditangkap pada Senin (27/2/2023) dini hari.
nltk.download('stopwords')
nltk.download('wordnet')
stop_words = set(stopwords.words('indonesian'))
def remove_stopwords(text):
words = text.split()
words = [word for word in words if word not in stop_words]
return ' '.join(words)
def clean_texts(text):
text = re.sub('\n',' ',text) # Remove every '\n'
text = re.sub(' +', ' ', text) # Remove extra spaces
text = re.sub('[\u2013\u2014]', '-', text) # Sub — and – char to -
text = re.sub('(.{0,40})-', '', text) # Remove news website/location at the beginning
text = re.sub(r'[^a-zA-Z\s]', '', text) # Remove non alphanbet characters
return text
def preprocess_text(text):
text = text.lower()
text = clean_texts(text)
text = remove_stopwords(text)
return text