find_skip_grams: Convert a list of tokens to skip-grams

Description Usage Arguments Value References Examples

View source: R/find_skip_grams.R

Description

This code takes a list of text vectors, and returns a list of skip-grams

Usage

1
find_skip_grams(dat, n, verbose = FALSE)

Arguments

dat

a list of character vectors

n

the number of skip frams

verbose

whether to print a progress bar

Value

a list of character vectors

References

http://stackoverflow.com/questions/16489748/converting-a-list-of-tokens-to-n-grams

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
find_skip_grams(
  list(
    c('one'), c('sent', 'one'),
    c('this', 'is', 'sentence', 'two'),
    c('finally', 'we', 'have', 'a', 'third', 'longer', 'sentence'),
    character(0),
    NULL,
    NA,
    NaN
  ),
  n=3,
  verbose=TRUE
)

zachmayer/r2vec documentation built on May 4, 2019, 9:05 p.m.