rate_sentence: Generate and rate sentence.

Description Usage Arguments Value Word types Author(s) Examples

Description

Generates one or more sentences and asks user to rate them in the console.

Pass question, rating scale, and min/max rating labels.

Randomly create rating scales - either once or for each sentence.

Min/max rating labels can be passed as word types. Words are sampled either once or once per sentence. See Word types below.

Usage

1
2
3
4
5
rate_sentence(n = 1, question = "Was this sentence funny?", rscale = c(1,
  10), max_rating = "Extremely", min_rating = "Not at all!",
  change_label = FALSE, change_rscale = FALSE, rscale_limits = c(1, 1000),
  simulate = FALSE, structures = NULL, word_lists = NULL,
  int_structures = TRUE, int_word_lists = TRUE)

Arguments

n

Number of sentences to generate (Integer).

question

(Character)

rscale

Rating scale min and max.

E.g. c(1,10)

Pass 'random' to randomize scale. To only randomize min OR max, pass e.g. c('random',10).

max_rating

Label for max rating value

min_rating

Label for min rating value

change_label

Whether to sample new word for labels, which have been passed as word types, on each run or only once (Logical).

change_rscale

Whether to create new random scale on each run or only once (Logical).

rscale_limits

Limits if generating random scale

E.g. c(1,1000)

simulate

Simulate user ratings (Logical).

structures

Character Vector. E.g.:

c("My [noun] is [positive_adj] today!", "[salutation]! How you've grown with the task!")

Constrain the selection of words by specifying word info codes. E.g. only sample elements from the word list with max. 1 word in them, i.e. no white spaces:

"[salutation(w1)]"

Pass multiple word types - from which one is randomly selected:

"[male_first_name/female_first_name]"

See available Word Types below.

See available Word Info Codes below.

word_lists

List of word lists. A word list is named by the word type, e.g. verb.

int_structures

Use internal structures (Logical).

int_word_lists

Use internal word lists (Logical).

Value

Collected responses, sentences, rating labels and and the rating scale (Dataframe).

Word types

Word lists have been collected from the internet. They might contain words that seem out of place. Let me know and I'll remove them.

Positive words

[superb] [positive_adj] [positive_vb] [positive_vb_past] [positive_adv]

Verb forms

[verb_base] [verb_past] [verb_past_participle] [verb_es] [verb_ing]

Noun forms

[noun] [noun_plural]

Persons

[salutation] [male_first_name] [female_first_name] [male_full_name] [female_full_name]

Specific synonyms

Notice: These are added as needed by author.

[create_syn] [small_syn] [big_syn]

Nationality

[nationality_adj] [nationality_people]

Statistics

[statistics_tradition]

Author(s)

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Attach package
library(bhappyr)

# Notice: The argument 'simulate' is set to TRUE
# as the function is elsewise interactive, i.e.
# it is waiting for user input.
# Remove or set to FALSE when running as experiment!

# Example 1
# Generate 1 sentence and rate it.
rate_sentence(n=1, simulate = TRUE)

# Example 2
# Generate 3 sentences and rate them.
# Use random scale on each run.
rate_sentence(n=3, rscale = 'random',
              change_rscale = TRUE,
              simulate = TRUE)

# Example 3
# Generate 3 sentences and rate them.
# Use random max_rating label on each run.
rate_sentence(n=3, max_rating = "[superb(upper)]",
              change_label = TRUE,
              simulate = TRUE)

LudvigOlsen/bhappyr documentation built on May 7, 2019, 2:02 p.m.