UMA-projekt/stopwords_filter.py

10 lines
315 B
Python
Raw Permalink Normal View History

2022-06-19 13:16:05 +02:00
from gensim.parsing import remove_stopwords, preprocess_string
def filter_stopwords(df):
filtered_df = df.copy()
filters = [remove_stopwords]
for i in range(len(filtered_df)):
filtered_df.at[i, 'Input'] = ' '.join(preprocess_string(filtered_df.at[i, 'Input'], filters))
return filtered_df