I want to remove stopwords using spaCy after tokenize. But, given me an error and the error is AttributeError: 'str' object has no attribute 'is_stop' The data I want to do is the data after the tokenizing process which is in column named 'tokenizing'
How to fix it?
import pandas as pd
from spacy.lang.id import Indonesian
nlp = Indonesian()
data = [
'Aku suka sekali beradai di wilayah yang dingin',
'Kembali jika terjadi sesuatu di sana',
'Sampai berapa lama kamu akan pergi dari sini',
]
df = pd.DataFrame({'text': data})
df['text'] = df['text'].str.lower()
df.head()
#Tokenizing
def tokenize(word):
return [token.text for token in nlp(word)]
df['tokenizing'] = df['text'].apply(tokenize)
df.head()
#Remove stopwords
def stopwords_remover(words):
return [stopwords for stopwords in words if not stopwords.is_stop]
df['stopwords'] = df['tokenizing'].apply(stopwords_remover)
df
