## Use a pre-built annotated plain text document obtained by employing an
## annotator pipeline from package 'StanfordCoreNLP', available from the
## repository at , using the following code:
## require("StanfordCoreNLP")
## s <- paste("Stanford University is located in California.",
## "It is a great university.")
## p <- StanfordCoreNLP_Pipeline(c("pos", "lemma", "parse"))
## d <- AnnotatedPlainTextDocument(s, p(s))
d <- readRDS(system.file("texts", "stanford.rds", package = "NLP"))
d
## Extract available annotation:
a <- annotation(d)
a
## Structured views:
sents(d)
tagged_sents(d)
tagged_sents(d, map = Universal_POS_tags_map)
parsed_sents(d)
## Add (trivial) paragraph annotation:
s <- as.character(d)
a <- annotate(s, Simple_Para_Token_Annotator(blankline_tokenizer), a)
d <- AnnotatedPlainTextDocument(s, a)
## Structured view:
paras(d)
Run the code above in your browser using DataLab