text_html_output_1.png
from Sastrawi.Stemmer.StemmerFactory import StemmerFactory

from nltk.tokenize import word_tokenize

from sklearn.feature_extraction.text import TfidfVectorizer

from sklearn.preprocessing import LabelEncoder

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

factory = StemmerFactory()
stemmer = factory.create_stemmer()
Encoder = LabelEncoder()
Tfidf_vect = TfidfVectorizer()

data_train = pd.read_csv('../input/indonesiafalsenews/Data_latih.csv')

false_news = data_train[data_train['label'] == 1].sample(frac=1)
true_fact = data_train[data_train['label'] == 0]
df = true_fact.append(false_news[:len(true_fact) + 200])
df

feature = df['narasi']
label = df['label']

lower = [stemmer.stem(row.lower()) for row in feature]
lower

tokens = [word_tokenize(element) for element in lower]
tokens