ngram_complexity: Determine NGram Complexity

Description Usage Arguments Examples

View source: R/document.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ngram_complexity(document)

## S3 method for class 'ngram_document'
ngram_complexity(document)

## S3 method for class 'ngram_documents'
ngram_complexity(document)

## S3 method for class 'JuliaObject'
ngram_complexity(document)

Arguments

document

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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)

## End(Not run)

news-r/textanalysis documentation built on Nov. 4, 2019, 9:40 p.m.