【发布时间】:2021-06-04 09:28:45
【问题描述】:
我想将定义的函数“标记化”应用于数据集“reviews_english”的“Review Gast”列的所有行。我怎样才能做到这一点?目前我只能将它应用到一行。谢谢! :)
def tokenization(text):
# Normalize
text = normalize(text)
# Remove Punctuation
text = remove_punctuation(text)
# Tokenize
tokens = text.split()
# Remove Stopwords
tokens = remove_stopwords(tokens)
# Apply Bag-of-Words (set of tokens)
bow = set(tokens)
return bow
clean_reviews_english =tokenization(reviews_english["Review Gast"][0])
print(clean_reviews_english)
【问题讨论】:
标签: python function sentiment-analysis review