Commit
·
7dd618f
1
Parent(s):
6ea428f
Update app.py
Browse files
app.py
CHANGED
@@ -286,50 +286,50 @@ if st.button("Analysis") and input_option == "Teks Manual" and user_input:
|
|
286 |
analisis = True
|
287 |
|
288 |
elif input_option == "Unggah Berkas XLSX" and uploaded_file is not None:
|
289 |
-
if 'Text' in df.columns:
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
else:
|
312 |
-
|
313 |
-
sentiment_label = predict_sentiment(text, sentiment_model, tfidf_vectorizer, lookp_dict)
|
314 |
-
emoticon = get_emoticon(sentiment_label)
|
315 |
-
cleaned_text = clean_text(text)
|
316 |
-
norm_slang_text = normalize_slang(cleaned_text, lookp_dict)
|
317 |
-
tanpa_stopwords = remove_stopwords(norm_slang_text, stop_words)
|
318 |
-
|
319 |
-
result_entry = {
|
320 |
-
'Text': text,
|
321 |
-
'cleaned-text': cleaned_text,
|
322 |
-
'normalisasi-text': norm_slang_text,
|
323 |
-
'stopwords-remove': tanpa_stopwords,
|
324 |
-
'label': sentiment_label,
|
325 |
-
'emotikon': emoticon,
|
326 |
-
}
|
327 |
-
|
328 |
-
results.append(result_entry)
|
329 |
-
|
330 |
-
analisis = True
|
331 |
-
else:
|
332 |
-
st.warning("Berkas XLSX harus memiliki kolom bernama 'Text' untuk analisis sentimen.")
|
333 |
|
334 |
|
335 |
st.info('Tekan "Analysis" kembali jika tampilan menghilang', icon = 'ℹ️')
|
|
|
286 |
analisis = True
|
287 |
|
288 |
elif input_option == "Unggah Berkas XLSX" and uploaded_file is not None:
|
289 |
+
if 'Text' in df.columns:
|
290 |
+
if 'Date' in df.columns:
|
291 |
+
for text, date in zip(texts, df['Date']):
|
292 |
+
sentiment_label = predict_sentiment(text, sentiment_model, tfidf_vectorizer, lookp_dict)
|
293 |
+
emoticon = get_emoticon(sentiment_label)
|
294 |
+
cleaned_text = clean_text(text)
|
295 |
+
norm_slang_text = normalize_slang(cleaned_text, lookp_dict)
|
296 |
+
tanpa_stopwords = remove_stopwords(norm_slang_text, stop_words)
|
297 |
+
|
298 |
+
result_entry = {
|
299 |
+
'Text': text,
|
300 |
+
'cleaned-text': cleaned_text,
|
301 |
+
'normalisasi-text': norm_slang_text,
|
302 |
+
'stopwords-remove': tanpa_stopwords,
|
303 |
+
'label': sentiment_label,
|
304 |
+
'emotikon': emoticon,
|
305 |
+
'Date': date,
|
306 |
+
}
|
307 |
+
|
308 |
+
results.append(result_entry)
|
309 |
+
|
310 |
+
analisis = True
|
311 |
+
else:
|
312 |
+
for text in texts:
|
313 |
+
sentiment_label = predict_sentiment(text, sentiment_model, tfidf_vectorizer, lookp_dict)
|
314 |
+
emoticon = get_emoticon(sentiment_label)
|
315 |
+
cleaned_text = clean_text(text)
|
316 |
+
norm_slang_text = normalize_slang(cleaned_text, lookp_dict)
|
317 |
+
tanpa_stopwords = remove_stopwords(norm_slang_text, stop_words)
|
318 |
+
|
319 |
+
result_entry = {
|
320 |
+
'Text': text,
|
321 |
+
'cleaned-text': cleaned_text,
|
322 |
+
'normalisasi-text': norm_slang_text,
|
323 |
+
'stopwords-remove': tanpa_stopwords,
|
324 |
+
'label': sentiment_label,
|
325 |
+
'emotikon': emoticon,
|
326 |
+
}
|
327 |
+
|
328 |
+
results.append(result_entry)
|
329 |
+
|
330 |
+
analisis = True
|
331 |
else:
|
332 |
+
st.warning("Berkas XLSX harus memiliki kolom bernama 'Text' untuk analisis sentimen.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
333 |
|
334 |
|
335 |
st.info('Tekan "Analysis" kembali jika tampilan menghilang', icon = 'ℹ️')
|