Get the utterances surrounding a token(s)

get_contexts(
  collection = NULL,
  language = NULL,
  corpus = NULL,
  role = NULL,
  role_exclude = NULL,
  age = NULL,
  sex = NULL,
  target_child = NULL,
  token,
  window = c(0, 0),
  remove_duplicates = TRUE,
  connection = NULL,
  db_version = "current",
  db_args = NULL
)

Arguments

collection

A character vector of one or more names of collections

language

A character vector of one or more languages

corpus

A character vector of one or more names of corpora

role

A character vector of one or more roles to include

role_exclude

A character vector of one or more roles to exclude

age

A numeric vector of an single age value or a min age value and max age value (inclusive) in months. For a single age value, participants are returned for which that age is within their age range; for two ages, participants are returned for whose age overlaps with the interval between those two ages.

sex

A character vector of values "male" and/or "female"

target_child

A character vector of one or more names of children

token

A character vector of one or more token patterns (`%` matches any number of wildcard characters, `_` matches exactly one wildcard character)

window

A length 2 numeric vector of how many utterances before and after each utterance containing the target token to retrieve

remove_duplicates

A boolean indicating whether to remove duplicate utterances from the results

connection

A connection to the CHILDES database

db_version

String of the name of database version to use

db_args

List with host, user, and password defined

Value

A 'tbl' of Utterance data, filtered down by supplied arguments.

Examples

# \donttest{ get_contexts(target_child = "Shem", token = "dog")
#> Using current database version: '2020.1'.
#> Getting data from 1 child in 1 corpus ...
#> # A tibble: 199 x 27 #> utterance_id gloss stem actual_phonology model_phonology type language #> <int> <chr> <chr> <chr> <chr> <chr> <chr> #> 1 345795 dog dog "" "" decl… eng #> 2 345796 that's … that a… "" "" ques… eng #> 3 345798 what's … what t… "" "" ques… eng #> 4 345802 is that… be tha… "" "" ques… eng #> 5 345804 when do… when d… "" "" ques… eng #> 6 347468 now try… now tr… "" "" decl… eng #> 7 347491 what's … what w… "" "" ques… eng #> 8 347507 he went… he go … "" "" ques… eng #> 9 347701 there's… there … "" "" ques… eng #> 10 348053 this a … this a… "" "" ques… eng #> # … with 189 more rows, and 20 more variables: num_morphemes <int>, #> # num_tokens <int>, utterance_order <int>, corpus_name <chr>, #> # part_of_speech <chr>, speaker_code <chr>, speaker_name <chr>, #> # speaker_role <chr>, target_child_name <chr>, target_child_age <dbl>, #> # target_child_sex <chr>, media_start <dbl>, media_end <dbl>, #> # media_unit <chr>, collection_name <chr>, collection_id <int>, #> # corpus_id <int>, speaker_id <int>, target_child_id <int>, #> # transcript_id <int>
# }