【发布时间】:2020-12-11 04:17:48
【问题描述】:
我试图弄清楚如何在 R 中的文本中识别一元和二元,然后根据阈值将两者保留在最终输出中。我已经用 gensim 的 Phraser 模型在 Python 中完成了这项工作,但还没有弄清楚如何在 R 中完成。
例如:
strings <- data.frame(text = 'This is a great movie from yesterday', 'I went to the movies', 'Great movie time at the theater', 'I went to the theater yesterday')
#Pseudocode below
bigs <- tokenize_uni_bi(strings, n = 1:2, threshold = 2)
print(bigs)
[['this', 'great_movie', 'yesterday'], ['went', 'movies'], ['great_movie', 'theater'], ['went', 'theater', 'yesterday']]
谢谢!
【问题讨论】: