【发布时间】:2023-03-25 21:52:01
【问题描述】:
这是我的数据框 df 中的文本,其中有一个名为“problem_note_text”的文本列
SSCI 问题:票据分配器故障执行检查/分配器故障/要求商店将票据分配器取出并放回原处/仍然错误消息显示前门已打开/因此 CE attn req联系方式详细信息 - Olivia taber 01159063390 / 上午 7 点至晚上 11 点
df$problem_note_text <- tolower(df$problem_note_text)
df$problem_note_text <- tm::removeNumbers(df$problem_note_text)
df$problem_note_text<- str_replace_all(df$problem_note_text, " ", "") # replace double spaces with single space
df$problem_note_text = str_replace_all(df$problem_note_text, pattern = "[[:punct:]]", " ")
df$problem_note_text<- tm::removeWords(x = df$problem_note_text, stopwords(kind = 'english'))
Words = all_words(df$problem_note_text, begins.with=NULL)
现在有一个数据框,它有一个单词列表,但有像
这样的单词“失败”
需要拆分成两个有意义的词,比如
“失败”“执行”。
我该怎么做,单词数据框也包含像
这样的单词“我”,“h”
这没有意义,必须删除,我不知道如何实现。
【问题讨论】:
-
如果没有模式,则不可行
-
你会如何对待
nowhere之类的东西 - 如no和where或now和here? -
我在想也许有一些可用的字典可以用来解析句子。我使用qdap包all_words函数从我有的句子中取出单词,但是似乎有几个单词没有被很好地解析,我得到了没有意义的联合词。
-
你能分享一段数据吗?如果传感器建议在您的文档中作为两个单独的单词出现,您可以更改预处理以避免丢失空间。
-
我猜这可能是因为您在原始数据中有连字符的分隔字符(即
sensor-advised)。如果您可以分享一些导致问题的数据(简单的搜索应该会显示导致问题的初始单词),我们可以更好地指导您。以下 qdap 小插图可以帮助调试和清理文本以隔离问题:cran.r-project.org/web/packages/qdap/vignettes/…
标签: r string-split stemming text-analysis