Learn R Programming

SemNetCleaner (version 1.0.0)

spell.check.dictionary: Spelling-check using SemNetDictionaries

Description

A wrapper function for spell-checking text dictionaries in SemNetDictionaries (combines all spell-checking wrapper functions)

Usage

spell.check.dictionary(check, dictionary, tolerance = 1)

Arguments

check

Character vector. A vector of unique responses from text data

dictionary

Character vector. See SemNetDictionaries

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 tolerace is tolerance = 1, which only spell corrects a word if there is only one word with a DL distance of 1.

Value

Returns a list containing:

resp

A vector of cleaned responses

dict

The updated dictionary vector

Examples

Run this code
# NOT RUN {
#load trial data
dat <- unique(unlist(as.data.frame(trial)))

# }
# NOT RUN {
scd <- spell.check.dictionary(dat, SemNetDictionaries::animals.dictionary)
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab