Determine whether an ngram_document (output of ngram_document) contains unigrams, bigrams or a higher-order representation.

ngram_complexity(document)

# S3 method for ngram_document
ngram_complexity(document)

# S3 method for ngram_documents
ngram_complexity(document)

# S3 method for JuliaObject
ngram_complexity(document)

Arguments

document

A document as returned by the *_document family of functions, i.e.: string_document.

Examples

# NOT RUN {
init_textanalysis()

# build document
unigram <- ngram_document("This is a document.", 1L)
bigram <- ngram_document("This is a document.", 2L)

# test complexity
identical(ngram_complexity(unigram), 1L)
identical(ngram_complexity(bigram), 2L)
# }