Learn R Programming

ngram (version 3.2.3)

babble: ngram Babbler

Description

The babbler uses its own internal PRNG (i.e., not R's), so seeds cannot be managed as with R's seeds. The generator is an implementation of MT19937.

At this time, we note that the seed may not guarantee the same results across machines. Currently only Solaris produces different values from mainstream platforms (Windows, Mac, Linux, FreeBSD), but potentially others could as well.

Usage

babble(ng, genlen = 150, seed = getseed())

# S4 method for ngram babble(ng, genlen = 150, seed = getseed())

Arguments

ng

An ngram object.

genlen

Generated length, i.e., the number of words to babble.

seed

Seed for the random number generator.

Details

A markov chain babbler.

See Also

ngram, getseed

Examples

Run this code
library(ngram)

str = "A B A C A B B"
ng = ngram(str)
babble(ng, genlen=5, seed=1234)

Run the code above in your browser using DataLab