Learn R Programming

SemNetCleaner (version 1.1.5)

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, part.resp, tolerance = 1)

Arguments

check

Character vector. A vector of unique responses from text data

dictionary

Character vector. See SemNetDictionaries

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.

Value

Returns a list containing:

from

A list of all responses before they were cleaned

to

A list of all responses after they were cleaned

dict

The updated dictionary vector

from.inc

A list of only incorrect responses before they were cleaned

to.inc

A list of only incorrect responses after they were cleaned

Examples

Run this code
# NOT RUN {
# Toy example
raw <- open.animals[c(1:10),-c(1:3)]

if(interactive())
{
    scd <- spell.check.dictionary(check = unique(unlist(raw)),
    dictionary = SemNetDictionaries::animals.dictionary,
    part.resp = raw) 
}

# }

Run the code above in your browser using DataLab