naufalnashif
commited on
Commit
·
e596d85
1
Parent(s):
4b2e55f
Update app.py
Browse files
app.py
CHANGED
@@ -76,8 +76,7 @@ def normalize_slang(text, slang_dict):
|
|
76 |
return ' '.join(normalized_words)
|
77 |
|
78 |
# Fungsi untuk ekstraksi fitur TF-IDF
|
79 |
-
|
80 |
-
def extract_tfidf_features(texts, _tfidf_vectorizer):
|
81 |
tfidf_matrix = tfidf_vectorizer.transform(texts)
|
82 |
return tfidf_matrix
|
83 |
|
@@ -104,8 +103,8 @@ def select_sentiment_model(selected_model):
|
|
104 |
|
105 |
|
106 |
# Fungsi untuk prediksi sentimen
|
107 |
-
|
108 |
-
def predict_sentiment(text,
|
109 |
# Tahap-1: Membersihkan dan normalisasi teks
|
110 |
cleaned_text = clean_text(text)
|
111 |
norm_slang_text = normalize_slang(cleaned_text, slang_dict)
|
|
|
76 |
return ' '.join(normalized_words)
|
77 |
|
78 |
# Fungsi untuk ekstraksi fitur TF-IDF
|
79 |
+
def extract_tfidf_features(texts, tfidf_vectorizer):
|
|
|
80 |
tfidf_matrix = tfidf_vectorizer.transform(texts)
|
81 |
return tfidf_matrix
|
82 |
|
|
|
103 |
|
104 |
|
105 |
# Fungsi untuk prediksi sentimen
|
106 |
+
|
107 |
+
def predict_sentiment(text, model, tfidf_vectorizer, slang_dict):
|
108 |
# Tahap-1: Membersihkan dan normalisasi teks
|
109 |
cleaned_text = clean_text(text)
|
110 |
norm_slang_text = normalize_slang(cleaned_text, slang_dict)
|