0
设定笔者在语料库中每个文档我有一个TM语料库对象是这样的:如何通过解析文档ID
> summary(corp.eng)
A corpus with 154 text documents
The metadata consists of 2 tag-value pairs and a data frame
Available tags are:
create_date creator
Available variables in the data frame are:
MetaID
在语料库每个文件的元数据中查找此:
> meta(corp.eng[[1]])
Available meta data pairs are:
Author :
DateTimeStamp: 2013-04-18 14:37:24
Description :
Heading :
ID : Smith-John_e.txt
Language : en_CA
Origin :
我知道我可以在这个时间设置一个文件的作者:
meta(corp.eng[[1]],tag="Author") <-
paste(
rev(
unlist(
strsplit(meta(corp.eng[[1]],tag="ID"), c("[-_]"))
)[1:2]
), collapse=' ')
,给了我这样的结果:
> meta(corp.eng[[1]],tag="Author")
[1] "John Smith"
如何对作业进行批处理?
meta {tm} description http://www.inside-r.org/packages/cran/tm/docs/meta。 'tm'有一个被称为“原油”的数据集。尽管我对ID的特定解析不适用,但如果要将其用于测试,则应用任何函数都可以。 – dnagirl
'lapply'返回一个列表。我需要编辑语料库。 – dnagirl