random_data: Generate Random Dialogue Data

View source: R/random_sent.R

random_sentR Documentation

Generate Random Dialogue Data

Description

random_sent - Generates a random sample of sentences (sentences are sampled at the word level and there for are likely nonsensical).

random_data - Generate random dialogue, people, and demographic variables

Usage

random_sent(
  n = 10,
  len = 14,
  range = len - 1,
  dictionary = qdapDictionaries::Top200Words,
  endmark.fun = function() sample(c(".", "!", "|", "?"), 1, prob = c(0.85, 0.05, 0.05,
    0.05))
)

random_data(
  n = 10,
  ...,
  n.people = 10,
  ages = 7:10,
  people.names = unique(tolower(qdapDictionaries::NAMES[[1]]))
)

Arguments

n

Number of sentences to create.

len

Average length of sentences (in words).

range

Range around len that number of words may vary. This may be a recycled single integer vector or an integer vector of length 2.

dictionary

A dictionary of words to sample from.

endmark.fun

A function to create random end marks.

n.people

An integer of the number of people to include in the sample (number of people is sampled from; if n is smaller not all people may be included).

ages

The possible ages to choose from (numeric).

people.names

A vector of names to choose from at least as large as n.people.

...

Other arguments passed to random_sent

Value

random_sent - Returns a random vector of sentence strings.

random_data - Returns a data.frame of people, dialogue, and demographic variables of the class sent_split.

Examples

## Not run: 
random_sent()
random_sent(200, 10)

dict <- sort(unique(bag_o_words(pres_debates2012[["dialogue"]])))
random_sent(dictionary=dict)

random_data()
random_data(ages = seq(10, 20, by = .5))
random_data(50) %&% word_stats(person)
random_data(100) %&% word_stats(list(race, sex))
random_data(dictionary = dict)

## End(Not run)

qdap documentation built on May 31, 2023, 5:20 p.m.