spacyr-methods.Rd
These functions provide quanteda methods for spacyr objects, and also extend spacy_parse to work with corpus objects.
# S3 method for corpus spacy_parse(x, ...)
x | an object returned by |
---|---|
... | unused except for |
docnames(x)
returns the document names
ndoc(x)
returns the number of documents
ntoken(x, ...)
returns the number of tokens by document
ntype(x, ...)
returns the number of types (unique tokens) by document
spacy_parse(x, ...)
is also defined for a quanteda corpus
# NOT RUN { library("spacyr") spacy_initialize() txt <- c(doc1 = "And now, now, now for something completely different.", doc2 = "Jack and Jill are children.") parsed <- spacy_parse(txt) ntype(parsed) ntoken(parsed) ndoc(parsed) docnames(parsed) corpus_subset(data_corpus_inaugural, Year <= 1793) %>% spacy_parse() # }