strip_sparse_terms: Strip Sparse Terms

Description Usage Arguments Examples

View source: R/prepare.R View source: R/prepare.R

Description

Remove sparse words.

Remove sparse words.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
strip_sparse_terms(text)

## S3 method for class 'corpus'
strip_sparse_terms(text)

## S3 method for class 'documents'
strip_sparse_terms(text)

## S3 method for class 'document'
strip_sparse_terms(text)

strip_sparse_terms(text)

## S3 method for class 'corpus'
strip_sparse_terms(text)

## S3 method for class 'documents'
strip_sparse_terms(text)

## S3 method for class 'document'
strip_sparse_terms(text)

Arguments

text

An object inheriting of class document or corpus.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 
init_textanalysis()

# build document
# must be lowercase
doc <- string_document("This is 1 document.")

# replaces in place!
strip_sparse_terms(doc)
get_text(doc)

## End(Not run)

## Not run: 
init_textanalysis()

# build document
str <- paste0(
  "This is a sentence.",
  "This is another sentence."
)
doc <- string_document(str)

# replaces in place!
strip_sparse_terms(doc)
get_text(doc)

## End(Not run)

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