DFM之前的搭配和复合

问题描述

我想使用文本列来查找短语,所以我尝试使用并置选项:

library(quanteda)

dataset1 <- data.frame( anumber = c(1,2,3),text = c("Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unknown printer took a galley of type and scrambled it to make a type specimen book.","It has survived not only five centuries,but also the leap into electronic typesetting,remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum","Contrary to popular belief,Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC,making it over 2000 years old. Richard McClintock,a Latin professor at Hampden-Sydney College in Virginia,looked up one of the more obscure Latin words,consectetur,from a Lorem Ipsum passage,and going through the cites of the word in classical literature,discovered the undoubtable source."))

    cols <- textstat_collocations(dataset1 $text,size = 2:3,min_count = 30)

在将化合物用于其频率之后,请尝试以下操作:

inputforDfm <- tokens_compound(cols)

tokens_compound.default(cols)中的错误: tokens_compound()仅适用于令牌对象。

但是需要令牌吗?如何制作并插入dfm中:

myDfm <- dataset1 %>%
corpus() %>%
tokens(remove_punct = TRUE,remove_numbers = TRUE,remove_symbols = TRUE) %>%
dfm()

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)