带字典的tm_map出错

时间:2014-03-09 03:09:44

标签: r tm word-cloud

我使用下面的代码来发送文字 - http://www.publications.parliament.uk/pa/ld201213/ldhansrd/text/130110-0002.htm#13011048001187

我将几段文件复制到一个文本文件中并在代码下面运行。

   require(SnowballC)
   require(tm)
   require(wordcloud)

   getwd()
   src = paste0(getwd(),"/input")
   lords <- Corpus (DirSource(src))
   #inspect(lords)

   lords <- tm_map(lords, stripWhitespace)
   lords <- tm_map(lords, tolower)
   lords <- tm_map(lords, removeWords, stopwords("english"))

   lords <- tm_map(lords, removeWords, "noble")
   lords <- tm_map(lords, removeWords, c("lord","need","will"))

   dictCorpus = lords
   lords <- tm_map(lords, stemDocument, dictionary=dictCorpus)
   wordcloud(lords, scale=c(5,0.5)
      , max.words=100
      , random.order=FALSE
      , rot.per=0.35
      , use.r.layout=FALSE
      , colors=brewer.pal(8, "Dark2"))

但我得到以下错误     lords&lt; - tm_map(lords,stemDocument,dictionary = dictCorpus)     FUN错误(X [[1L]],...): FUN错误(X [[1L]],...):

  unused argument (dictionary = c("   anxiety among  involved  sickle cell services   complexity   services needed effectively places  largely outside  scope   clinical commissioning groups. many  concerned   type  policies     place  ensure   patient-centred, integrated approach  care engages primary care  community interests across health, social  community care.    help  reduce morbidity, needless hospital care   health inequalities experienced   seriously marginalised sector.", "", "  expectations    ccgs  local health  well- boards  aim  reflect  make-   respective client communities. , given   steady establishment  ccgs   view  community provision  sickle cell disorder management   major role  play across  country, especially  high-risk areas within ccgs, can  minister tell  house  priority   given  ccgs  people   sickle cell  thalassaemia community,   feeling concerned, vulnerable  anxious   situation   future?", 

“”,“然而,治疗镰状细胞研究需要”“

当我执行时     lords&lt; - tm_map(lords,stemDocument,dictionary = dictCorpus)

0 个答案:

没有答案