Replace terms with their hashed valued using a hash function that outputs integers from 1 to N.

create_hash_function(cardinality = 100L)

hash(text, hash_func)

# S3 method for character
hash(text, hash_func)

# S3 method for document
hash(text, hash_func = NULL)

# S3 method for documents
hash(text, hash_func = NULL)

# S3 method for dtm
hash(text, hash_func = NULL)

# S3 method for corpus
hash(text, hash_func = NULL)

Arguments

cardinality

Max index used for hashing (default 100).

text

A corpus, character string, a document, or a document_term_matrix.

hash_func

A hash function as returned by create_hash_function.

Examples

# NOT RUN {
init_textanalysis()

hash_func <- create_hash_function(10L)
hash("a", hash_func)

doc <- string_document("A simple document.")
hash(doc, hash_func)
# }