我想对pdf文件的语料库做一个简短的总结。我希望包括以下列:文本类型、标记、句子(如quanteda快速入门指南中所示),并排除所有其他列。从…
names(docvars(corp_mk))我得到了
[1] "author" "datetimestamp" "description" "heading" "id"
[6] "language" "origin" 这不应该显示在摘要中。
我尝试在summary()命令中使用"showmeta = FALSE“,但它仍然包含所有列。
我得到了:
Text Types Tokens Sentences author datetimestamp description
MoKa_BA_LG_16.pdf 1194 8620 283 Pressestelle 2016-07-27 13:01:04
MoKa_BBK_DO_18.pdf 810 2643 56 spalgen 2018-07-03 09:00:13 <NA>
MoKa_BBK_DUE_18.pdf 1327 6219 97 Suttkus 2018-01-24 14:44:37 <NA>当我想要
Text Types Tokens Sentences
MoKa_BA_LG_16.pdf 1194 8620 283
MoKa_BBK_DO_18.pdf 810 2643 56
MoKa_BBK_DUE_18.pdf 1327 6219 97 在做摘要之前,我是否必须从语料库中提取列,或者可以使用quanteda命令来完成?
发布于 2019-05-04 19:32:51
summary.corpus()方法以静默方式返回打印的data.frame。因此,如果您只想要文本摘要列,请按以下方式将其分割出来:
library("quanteda")
## Package version: 1.4.3
## Parallel computing: 2 of 12 threads used.
## See https://quanteda.io for tutorials and examples.
summary(data_corpus_irishbudget2010)[, c("Text", "Types", "Tokens", "Sentences")]
## Text Types Tokens Sentences
## 1 Lenihan, Brian (FF) 1953 8641 374
## 2 Bruton, Richard (FG) 1040 4446 217
## 3 Burton, Joan (LAB) 1624 6393 307
## 4 Morgan, Arthur (SF) 1595 7107 343
## 5 Cowen, Brian (FF) 1629 6599 250
## 6 Kenny, Enda (FG) 1148 4232 153
## 7 ODonnell, Kieran (FG) 678 2297 133
## 8 Gilmore, Eamon (LAB) 1181 4177 201
## 9 Higgins, Michael (LAB) 488 1286 44
## 10 Quinn, Ruairi (LAB) 439 1284 59
## 11 Gormley, John (Green) 401 1030 49
## 12 Ryan, Eamon (Green) 510 1643 90
## 13 Cuffe, Ciaran (Green) 442 1240 45
## 14 OCaolain, Caoimhghin (SF) 1188 4044 176https://stackoverflow.com/questions/55981723
复制相似问题