whe_post_gram: Get following bigrams

Description Usage Arguments Value See Also Examples

Description

Get following bigrams

Usage

1
2
3
4
5
6
7
whe_post_gram(wh, n = 2, flatten = FALSE)

## S3 method for class 'data.frame'
whe_post_gram(wh, n = 2, flatten = FALSE)

## S3 method for class 'character'
whe_post_gram(wh, n = 2, flatten = FALSE)

Arguments

wh

highlighted object returned by wh_collect, see examples.

n

number of terms, defaults to 2.

flatten

whether to flatten ngrams.

Value

if data.frame is passed will append a column named pre.gram.n where n is the number of terms, parameter n. If character vector is passed will return list (or vector dependeing on flatten) of n-grams.

See Also

whe_pre_gram

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
library(webhose)
token <- wh_token("xXX-x0X0xX0X-00X")

token %>%
  wh_news(q = '"R programming"') %>%  # use highlight!
  wh_collect() -> rstats # collect results

rstats %>%
  whe_post_gram(3) -> post_trigrams

library(dplyr)
rstats %>%
  mutate(post.bigram = whe_post_gram(highlightText, flatten = TRUE)) -> post_bigrams

## End(Not run)

news-r/webhoserx documentation built on June 10, 2019, 12:27 a.m.