【发布时间】:2021-02-18 00:00:24
【问题描述】:
我正在尝试从意大利语书中获取文档术语矩阵。我有这本书的pdf文件,我写了几行代码:
#install.packages("pdftools")
library(pdftools)
library(tm)
text <- pdf_text("IoRobot.pdf")
# collapse pdf pages into 1
text <- paste(unlist(text), collapse ="")
myCorpus <- VCorpus(VectorSource(text))
mydtm <-DocumentTermMatrix(myCorpus,control = list(removeNumbers = TRUE, removePunctuation = TRUE,
stopwords=stopwords("it"), stemming=TRUE))
inspect(mydtm)
我在最后一行之后得到的结果是:
<<DocumentTermMatrix (documents: 1, terms: 10197)>>
Non-/sparse entries: 10197/0
Sparsity : 0%
Maximal term length: 39
Weighting : term frequency (tf)
Sample :
Terms
Docs calvin cosa donovan esser piú poi powel prima quando robot
1 201 191 254 193 288 211 287 166 184 62
我注意到稀疏度为 0%。这正常吗?
【问题讨论】: