簡體   English   中英

無法調整R的tm包中的findAssocs()

[英]Unable to tweak the findAssocs() in tm package in R

我試圖在輸入文本中查找前10個常用詞與其余常用詞之間的關聯。

當我查看findAssocs()的單個輸出時:

findAssocs(dtm, "good", corlimit=0.4)

通過打印已尋求關聯的“好”一詞,可以清楚地給出輸出。

$good
 better     got    hook    next content     fit  person 
   0.44    0.44    0.44    0.44    0.43    0.43    0.43 

但是,當我嘗試對具有前10個字的字符向量進行自動化處理時:

t10 <- c("busi", "entertain", "topic", "interact", "track", "content", "paper", "media", "game", "good")

輸出是這些元素中每一個元素的相關性列表,但是沒有單詞,並且已經關聯了。 示例輸出如下(請注意,t10 [i]處的單詞未打印,不像上面的單獨輸出中清楚地打印了“ good”一樣):

for(i in 1:10) {

   t10_words[i] <- as.list(findAssocs(dtm, t10[i], corlimit=0.4))
}


> t10_words
[[1]]
   littl descript  disrupt    enter    model 
    0.50     0.48     0.48     0.48     0.48 

[[2]]
  immers    anyth   effect     full holodeck      iot  problem      say startrek     such  suspect      wow 
    0.68     0.48     0.48     0.48     0.48     0.48     0.48     0.48     0.48     0.48     0.48     0.48 

[[3]]
         area        captur          give        overal          like          alon          avid         begin 
         0.51          0.47          0.47          0.47          0.44          0.43          0.43          0.43 
      circuit         cloud collaboration      communic     communiti        concis        confus         defin 
         0.43          0.43          0.43          0.43          0.43          0.43          0.43          0.43 
      discord        doesnt          drop enablesupport        esport         event         everi       everyon 
         0.43          0.43          0.43          0.43          0.43          0.43          0.43          0.43 

如何打印輸出以及實際的關聯詞?

有人可以幫我嗎?

謝謝。

運行for循環后,添加以下代碼:

names(t10_words) <- t10

這將使用t10中指定的單詞命名列表。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM