text_grams: Create n-grams from text

Description Usage Arguments Details Value Examples

Description

This function returns a DataFrame with k`` top ngrams. ngrams“ is a combination of n words occuring together with highest frequency in the text. The function will return multiple values in cases of frequency conflict.

Usage

1
2
3
text_grams(txt, k = 5, n = c(2, 3), stop_remove = TRUE,
  remove_punctuation = TRUE, remove_number = TRUE,
  case_sensitive = FALSE)

Arguments

txt

string

k

top ngrams

n

n combination of words

stop_remove

Boolean

remove_punctuation

Boolean

remove_number

Boolean

case_sensitive

Boolean

Details

Created on 09 February, 2019

Authors: Harjyot Kaur, Alexander Pak

Takes in a string and returns a data.frame Number of rows are dependent on the input n of the user Size of the list is dependent on the input k of the user

Value

data.frame

Examples

1
2
3
txt <-  "Today is a sunny day. We should go to a beach on this sunny day"

grams<- text_grams(txt)

UBC-MDS/RSyntext documentation built on May 7, 2019, 7:14 p.m.