Learn R Programming

spell.replacer (version 1.0.1)

spell_replace: Probabilistic Spelling Correction

Description

Automatically replaces misspelled words in a character vector based on their string distance from a list of words sorted by frequency in a corpus.

Usage

spell_replace(
  txt,
  word_list = coca_list,
  ignore_names = TRUE,
  threshold = 0.12,
  ignore_punct = FALSE
)

Value

A character vector with corrected spellings

Arguments

txt

A character vector containing text to be spell-checked

word_list

A character vector of correctly spelled words sorted by frequency (default: coca_list)

ignore_names

Logical. If TRUE, ignores potential proper names (capitalized words that appear multiple times)

threshold

Numeric. Maximum string distance threshold for considering a word as a correction candidate (default: 0.12)

ignore_punct

Logical. If TRUE, ignores punctuation when calculating string distance