Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -1,22 +1,29 @@
|
|
| 1 |
-
|
| 2 |
import pandas as pd
|
| 3 |
import numpy as np
|
|
|
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
import seaborn as sns
|
| 6 |
import pickle
|
| 7 |
import nltk
|
| 8 |
import tensorflow as tf
|
| 9 |
import re
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
from nltk.corpus import stopwords
|
| 12 |
from nltk.tokenize import word_tokenize, sent_tokenize
|
|
|
|
|
|
|
|
|
|
| 13 |
from sklearn.model_selection import train_test_split
|
| 14 |
-
from sklearn.metrics import classification_report, accuracy_score, confusion_matrix
|
| 15 |
-
|
| 16 |
-
from
|
| 17 |
-
from transformers import TFBertForSequenceClassification
|
| 18 |
-
nltk.download('punkt')
|
| 19 |
-
nltk.download('stopwords')
|
| 20 |
|
| 21 |
df = pd.read_csv("dataset_tweet_sentiment_pilkada_DKI_2017.csv")
|
| 22 |
|
|
|
|
| 1 |
+
# Mengimpor pustaka yang diperlukan
|
| 2 |
import pandas as pd
|
| 3 |
import numpy as np
|
| 4 |
+
import sklearn.manifold as manifold
|
| 5 |
import matplotlib.pyplot as plt
|
| 6 |
import seaborn as sns
|
| 7 |
import pickle
|
| 8 |
import nltk
|
| 9 |
import tensorflow as tf
|
| 10 |
import re
|
| 11 |
+
|
| 12 |
+
# Mengunduh tokenizer dan stopwords
|
| 13 |
+
nltk.download('punkt')
|
| 14 |
+
nltk.download('stopwords')
|
| 15 |
+
|
| 16 |
+
# Mengimpor komponen dari NLTK
|
| 17 |
from nltk.corpus import stopwords
|
| 18 |
from nltk.tokenize import word_tokenize, sent_tokenize
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
# Mengimpor komponen dari scikit-learn dan transformers
|
| 22 |
from sklearn.model_selection import train_test_split
|
| 23 |
+
from sklearn.metrics import classification_report, accuracy_score, confusion_matrix, roc_curve, auc
|
| 24 |
+
from sklearn.manifold import TSNE
|
| 25 |
+
from wordcloud import WordCloud
|
| 26 |
+
from transformers import BertTokenizer, TFBertForSequenceClassification
|
|
|
|
|
|
|
| 27 |
|
| 28 |
df = pd.read_csv("dataset_tweet_sentiment_pilkada_DKI_2017.csv")
|
| 29 |
|