r - 从词形还原词典中删除单词/更新文本词干中的词形词典
问题描述
我正在使用 textstem 包在某些回复中对单词进行词形还原。然而,有一个词(spotting)我不想被包括在内,并简化为“spot”。我希望它保持斑点。我怎么能做到这一点?我需要制作自定义词典吗?正在做:
lemmatize_strings(df, dictionary = lexicon::hash_lemmas)
解决方案
您可以创建自己的字典,在其中删除令牌spotting
# hash_lemmas is a datatable, so you can use column name token instead hash_lemmas$token
my_lex <- lexicon::hash_lemmas[!token == "spotting", ]
df_lemmatized <- lemmatize_strings(df, dictionary = my_lex)
或者,如果您想在不创建自己的词典的情况下这样做:
df_lemmatized <- lemmatize_strings(df, dictionary = lexicon::hash_lemmas[!token == "spotting", ])
推荐阅读
- c# - 从另一个项目获取 HTTP Post 值
- dynamic-programming - leetcode:解码方式dp解决方案
- python-3.x - Plotly - 点击图例项目 - 如何进行初始设置?
- java - 为什么我收到错误异常评估 SpringEL 表达式:“pagePost.totalPage > 0”?
- database - codeigniter:无法从一个函数获取返回值到同一控制器内的另一个函数?
- asp.net - 我应该为 ASP.NET Core REST API 使用哪个内存分析器
- node.js - 如何将数据放入弹性搜索数据存储 nodejs
- php - 仅显示包含数据库值的数组中的特定数据
- reactjs - 部署 ReactJS 和 Express Nginx
- elasticsearch - 如何使用 edge_nGram 自动完成单词而不是数字