title: Efficient n-gram analysis in R with cmscu.
abstract: We present a new R package, cmscu, which implements a Count-Min-Sketch with conservative updating (Cormode and Muthukrishnan Journal of Algorithms, 55(1), 58-75, 2005), and its application to n-gram analyses (Goyal et al. 2012). By writing the core implementation in C++ and exposing it to R via Rcpp, we are able to provide a memory-efficient, high-throughput, and easy-to-use library. As a proof of concept, we implemented the computationally challenging (Heafield et al. 2013) modified Kneser-Ney n-gram smoothing algorithm using cmscu as the querying engine. We then explore information density measures (Jaeger Cognitive Psychology, 61(1), 23-62, 2010) from n-gram frequencies (for n=2,3) derived from a corpus of over 2.2 million reviews provided by a Yelp, Inc. dataset. We demonstrate that these text data are at a scale beyond the reach of other more common, more general-purpose libraries available through CRAN. Using the cmscu library and the smoothing implementation, we find a positive relationship between review information density and reader review ratings. We end by highlighting the important use of new efficient tools to explore behavioral phenomena in large, relatively noisy data sets.
authors: University of California, Merced, 5200 N. Lake Rd., Merced, CA, USA. dvinson@ucmerced.edu.
authors: David W
authors: DW
authors: Vinson
authors: University of California, Merced, 5200 N. Lake Rd., Merced, CA, USA.
authors: Jason K
authors: JK
authors: Davis
authors: University of California, Merced, 5200 N. Lake Rd., Merced, CA, USA.
authors: Suzanne S
authors: SS
authors: Sindi
authors: University of California, Merced, 5200 N. Lake Rd., Merced, CA, USA.
authors: Rick
authors: R
authors: Dale
mesh_terms: D000465:Algorithms; D035841:Behavioral Research / Q000379:methods*; D003627:Data Interpretation, Statistical; D006801:Humans; D057386:Search Engine; D012984:Software
keywords: Big data; Information theory; Interdisciplinary collaboration; Sketch algorithms; n-grams