Learn R Programming

SemNetCleaner (version 1.1.5)

word.check.wrapper: A Spell-checking wrapper

Description

A wrapper function to spell-check with menu options

Usage

word.check.wrapper(
  word,
  dictionary,
  context = NULL,
  part.resp,
  tolerance = 1,
  rem.resp
)

Arguments

word

Character. A word to get spell-checked

dictionary

A dictionary to look for word in (see examples). See SemNetDictionaries

context

Vector. Defaults to NULL. When a word is inside of a vector of words, then the vector can be input to provide context for whether this word is spelled correctly with other words. For example, "guinea" is spelled correctly but will not be in animals.dictionary. The vector can be input to determine if "guinea pig" or "guinea fowl" is meant by the participant. The word that is being checked will appear with "<<" and ">>" around it in the context of other words (e.g., bat dog fish <<guinea>> pig rat horse)

part.resp

Matrix or data frame. Uncleaned participant response matrix

tolerance

Numeric. The distance tolerance set for automatic spell-correction purposes. This function uses the function stringdist to compute the Damerau-Levenshtein (DL) distance, which is used to determine potential best guesses.

Unique words (i.e., n = 1) that are within the (distance) tolerance are automatically output as best.guess responses, which are then passed through word.check.wrapper. If there is more than one word that is within or below the distance tolerance, then these will be provided as potential options.

The recommended and default distance tolerance is tolerance = 1, which only spell corrects a word if there is only one word with a DL distance of 1.

rem.resp

Matrix. Keeps track of decisions made in the cleaning process

Value

A list containing:

word

The spelling corrected word

dictionary

The updated dictionary

check

A check for whether a word has been added to the dictionary

rem.resp

A matrix to remember previous responses for spelling corrections

Details

A menu will appear with several options. Here is what is returned with each option:

  • POTENTIAL RESPONSE If a potential response is selected, then the input word is replaced with the potential response

  • ADD TO DICTIONARY When selected, the input word will be added to the appendix dictionary (see append.dictionary). The input word will be returned

  • TYPE MY OWN User will type their own response to replace the input word. If word is not in dictionary, then user will be prompted for whether they would like to add the word to their appendix dictionary (see append.dictionary). In all cases, the typed word will be returned

  • CONTEXT Provides the response in context of the participant's other responses. Prints the all participants responses that were given with the target response

  • GOOGLE IT "Googles" the response in question. A browser will open with the Google search terms: define "RESPONSE"

  • BAD RESPONSE When selected, NA will be returned

  • SKIP When selected, input word will be returned

  • BAD STRING Unique to continuous strings. When selected, a vector of NA the length of the context vector will be returned

  • CONTEXT Unique to single responses. Provides the response in context of the participant's other responses. Prints the all participants responses that were given with the target response

Examples

Run this code
# NOT RUN {
if(interactive())
{
    # Response needs to be checked
    word.check.wrapper("gost", SemNetDictionaries::animals.dictionary)
}

# }

Run the code above in your browser using DataLab