Learn R Programming

tm (version 0.7-12)

meta: Metadata Management

Description

Accessing and modifying metadata of text documents and corpora.

Usage

# 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

Arguments

x

For DublinCore a TextDocument, and for meta a TextDocument or a Corpus.

tag

a character giving the name of a metadatum. No tag corresponds to all available metadata.

type

a character specifying the kind of corpus metadata (see Details).

...

Not used.

value

replacement value.

Details

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/).

References

Dublin Core Metadata Initiative. https://dublincore.org/

See Also

meta for metadata in package NLP.

Examples

Run this code
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