
Last chance! 50% off unlimited learning
Sale ends in
Accessing and modifying metadata of text documents and corpora.
# S3 method for PCorpus
meta(x, tag = NULL, type = c("indexed", "corpus", "local"), ...)
# S3 method for PCorpus
meta(x, tag, type = c("indexed", "corpus", "local"), ...) <- value
# S3 method for SimpleCorpus
meta(x, tag = NULL, type = c("indexed", "corpus"), ...)
# S3 method for SimpleCorpus
meta(x, tag, type = c("indexed", "corpus"), ...) <- value
# S3 method for VCorpus
meta(x, tag = NULL, type = c("indexed", "corpus", "local"), ...)
# S3 method for VCorpus
meta(x, tag, type = c("indexed", "corpus", "local"), ...) <- value
# S3 method for PlainTextDocument
meta(x, tag = NULL, ...)
# S3 method for PlainTextDocument
meta(x, tag = NULL, ...) <- value
# S3 method for XMLTextDocument
meta(x, tag = NULL, ...)
# S3 method for XMLTextDocument
meta(x, tag = NULL, ...) <- value
DublinCore(x, tag = NULL)
DublinCore(x, tag) <- value
For DublinCore
a TextDocument
, and for
meta
a TextDocument
or a Corpus
.
a character giving the name of a metadatum. No tag corresponds to all available metadata.
a character specifying the kind of corpus metadata (see Details).
Not used.
replacement value.
A corpus has two types of metadata. Corpus metadata ("corpus"
)
contains corpus specific metadata in form of tag-value pairs.
Document level metadata ("indexed"
) contains document specific
metadata but is stored in the corpus as a data frame. Document level metadata
is typically used for semantic reasons (e.g., classifications of documents
form an own entity due to some high-level information like the range of
possible values) or for performance reasons (single access instead of
extracting metadata of each document). The latter can be seen as a from of
indexing, hence the name "indexed"
. Document metadata
("local"
) are tag-value pairs directly stored locally at the individual
documents.
DublinCore
is a convenience wrapper to access and modify the metadata
of a text document using the Simple Dublin Core schema (supporting the 15
metadata elements from the Dublin Core Metadata Element Set
https://dublincore.org/documents/dces/).
Dublin Core Metadata Initiative. https://dublincore.org/
meta
for metadata in package NLP.
data("crude")
meta(crude[[1]])
DublinCore(crude[[1]])
meta(crude[[1]], tag = "topics")
meta(crude[[1]], tag = "comment") <- "A short comment."
meta(crude[[1]], tag = "topics") <- NULL
DublinCore(crude[[1]], tag = "creator") <- "Ano Nymous"
DublinCore(crude[[1]], tag = "format") <- "XML"
DublinCore(crude[[1]])
meta(crude[[1]])
meta(crude)
meta(crude, type = "corpus")
meta(crude, "labels") <- 21:40
meta(crude)
Run the code above in your browser using DataLab