Trouble with findAssocs from package tm

风格不统一 提交于 2019-12-10 14:22:33

问题


I am attempting to find words associated with a particular word in a term document matrix using the tm package.

I am using findAssocs to do this. Arguments for findAssocs are:

  • x: A term-document matrix.
  • term: A character holding a term.
  • corlimit: A numeric for the lower correlation bound limit.

I am consistently getting numeric(0) as my result

Example:

findAssocs(test.dtm, "investment", 0.90)
>numeric(0)

Does anyone have familiarity with findAssocs and know what I am doing wrong? Or does anyone know more broadly what the numeric(0) result could mean?

Thank you very much in advance for any help.


回答1:


This result indicates that there are no words associated in 0.90 of documents with the term "investment". Try a lower threshold like 0.05 and work your way up to a threshold that yields fewer terms.




回答2:


I'm getting the same numeric(0), I think it's because there is only one document in my Corpus, so the document term matrix only have one column. You may want to test TermDocumentMatrix() and see if you have a multi-column matrix. That said, how do I find association within one document?.




回答3:


It does appear this functionality only works when analyzing multiple text documents. The only viable solution I have come up with is creating a duplicate of text document and then running the analysis. However, it is uncertain if this changes the results in any way. Any additional feedback would be appreciated.



来源:https://stackoverflow.com/questions/12629993/trouble-with-findassocs-from-package-tm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!