View source: R/autoscore_fun.R
autoscore | R Documentation |
The purpose of 'autoscore' is to automatically score word identification in speech perception research, such as studies involving listener understanding of speech in background noise or disordered speech. The program uses a flexible number of rules that determine whether a response set of words (i.e., listener transcriptions) match a target set of words (i.e., speech corpus). At the most basic level, Autoscore counts words in the listener transcript as correct if they match the words in the target phrase exactly (regardless of word order), or match a homophone or common misspelling of the target word. Individual rules can be applied or removed, depending on the needs of researcher and the scoring rules of the research lab. Examples of rules available in Autoscore include the ability to count as correct substitutions of articles (A for The) or differences in plural or tense (adding -s or -ed to a word). Additional rules can be added by the researcher as needed.
This function specifically takes a data frame with target words and response words and calculates the number of matches based on a number of scoring rules.
autoscore( .data, acceptable_df = NULL, plural_rule = FALSE, plural_add_rule = FALSE, tense_rule = FALSE, tense_add_rule = FALSE, a_the_rule = FALSE, root_word_rule = FALSE, double_letter_rule = FALSE, suffix_rule = FALSE, number_text_rule = FALSE, contractions_df = NULL, compound_rule = NULL, output = "text" )
.data |
The data.frame (or tbl_df) to be used to autoscore |
acceptable_df |
A user-provided 'data.frame' of original and alternate spellings for words in the target/response lists (this is the |
plural_rule |
if target or response added or subtracted -s and -es at the end of the word, count as correct (default = 'FALSE') |
plural_add_rule |
only if response has an additional -s or -es (not missing either at the end of the word) to be counted right. Differs from |
tense_rule |
if target or response added or subtracted -d and -ed at the end of the word, count as correct (default = 'FALSE') |
tense_add_rule |
only if response has an additional -d or -ed (not missing either at the end of the word) to be counted right. Differs from |
a_the_rule |
should "a" and "the" be considered the same? (default = 'FALSE') |
root_word_rule |
should a word that contains the target word at the beginning of the reponse word be considered correct (default = 'FALSE' because does "partial" matching which can bring in some unexpected results) |
double_letter_rule |
should double letters within a word (the t in 'attack') be considered the same as if there is only one of that latter ('atack'); some of these will be in the common_misspell_rule; default = 'FALSE' |
suffix_rule |
should the words be stemmed (all suffix characters removed)? (default = 'FALSE'); if 'TRUE', plural_rule and tense_rule are 'FALSE' |
number_text_rule |
should the numbers (e.g., 1, 2, 3) be used in word form (e.g., one, two, three) in the scoring? (default = 'FALSE') |
contractions_df |
list of contractions to change (e.g., "She'll" changed to "She will"). The built-in list of contractions can be seen with |
compound_rule |
named vector of 'c("correct" = "original")' form. For instance, "junkyard" is the target form but some responses were "junk yard". To fix, we can include a vector like 'c("junkyard" = "junk yard")'. |
output |
the output type for the autoscore table; current options are "text" (provides a cleaned data set) and "none" (which provides all data); others to follow soon |
library(tidyverse) library(autoscore) data("example_data") ## Using all the defaults autoscore(example_data) ## Using the default acceptable spellings list example_data %>% autoscore::autoscore(acceptable_df = autoscore::acceptable_spellings) ## Changing some of the rules example_data %>% autoscore::autoscore(acceptable_df = autoscore::acceptable_spellings, plural_rule = FALSE, tense_rule = FALSE) comp = c("junkyard" = "junk yard") example_data %>% autoscore::autoscore(compound_rule = comp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.