Spaces:
Sleeping
Sleeping
Commit
·
f45217d
1
Parent(s):
0819f8a
update self model for sentiment analysis
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ nltk.download('punkt')
|
|
18 |
nltk.download('stopwords')
|
19 |
|
20 |
# Load pipelines
|
21 |
-
sentiment_pipe = pipeline("text-classification", model="
|
22 |
emotion_pipe = pipeline("text-classification", model="azizp128/prediksi-emosi-indobert")
|
23 |
|
24 |
def load_slank_formal(file):
|
@@ -48,7 +48,7 @@ def preprocess_text(text, slank_formal_df):
|
|
48 |
text = re.sub(r'[&%]', lambda x: f' {x.group()} ', text)
|
49 |
text = re.sub(r'(\w)\1{1,}', r'\1\1', text)
|
50 |
text = re.sub(r'\s+', ' ', text).strip()
|
51 |
-
text = re.sub(r'\s*-\s
|
52 |
text = re.sub(r'(?<=\d)\s*\.\s*(?=\d)', '.', text)
|
53 |
text = re.sub(r'(?<=\d)\s*,\s*(?=\d)', ',', text)
|
54 |
text = re.sub(r'\s+', ' ', text).strip()
|
|
|
18 |
nltk.download('stopwords')
|
19 |
|
20 |
# Load pipelines
|
21 |
+
sentiment_pipe = pipeline("text-classification", model="dhanikitkat/indo_smsa-1.5G_sentiment_analysis")
|
22 |
emotion_pipe = pipeline("text-classification", model="azizp128/prediksi-emosi-indobert")
|
23 |
|
24 |
def load_slank_formal(file):
|
|
|
48 |
text = re.sub(r'[&%]', lambda x: f' {x.group()} ', text)
|
49 |
text = re.sub(r'(\w)\1{1,}', r'\1\1', text)
|
50 |
text = re.sub(r'\s+', ' ', text).strip()
|
51 |
+
text = re.sub(r'\b(\w+)\b\s*-\s*\b\1\b', r'\1-\1', text)
|
52 |
text = re.sub(r'(?<=\d)\s*\.\s*(?=\d)', '.', text)
|
53 |
text = re.sub(r'(?<=\d)\s*,\s*(?=\d)', ',', text)
|
54 |
text = re.sub(r'\s+', ' ', text).strip()
|