LinuxCommandLibrary

enchant

Spell check and correct text

SYNOPSIS

enchant [OPTION]... [FILE]

PARAMETERS

-a, --aspell-mode
    Enable Aspell compatibility mode

-C, --check
    Check spelling interactively without suggestions

-d DICT, --dicts DICT
    Use specified dictionary backend(s)

-D, --list-dicts
    List available dictionaries

-G, --suggs
    Output suggestions only for stdin words

-h, --help
    Display help and exit

-H, --ignore-headers
    Ignore email headers in files

-l LANG, --lang LANG
    Set language/dictionary (e.g., en_US)

-L, --list-langs
    List available languages

-P, --print-dict
    Print current dictionary details

-t, --html-syntax
    Parse input as HTML

-v, --verbose
    Enable verbose output

-V, --version
    Print version information

DESCRIPTION

The enchant command is a versatile frontend to various spell-checker modules, providing a unified interface for spell-checking tasks on Linux and Unix-like systems. It leverages backends such as Hunspell, Aspell, or Hspell to support multiple languages and dictionaries without requiring users to switch tools.

Primarily, enchant operates in two modes: interactive checking of files or stdin, where it highlights misspelled words and suggests corrections, and non-interactive modes for batch checking words or listing suggestions. When invoked without arguments, it enters interactive mode on stdin, mimicking tools like ispell. Options allow specifying languages (e.g., en_US), listing available dictionaries, or forcing specific backends.

It excels in handling diverse text formats, including HTML with --html-syntax, and ignores email headers via --ignore-headers. Verbose output aids debugging, while compatibility modes ensure seamless integration with legacy scripts. Widely used in editors like Vim (via plugins) and office suites like AbiWord, enchant abstracts backend complexities, enabling developers to build portable spell-checking features. Its lightweight design and extensibility make it ideal for scripts, CI pipelines, or ad-hoc checks, though performance depends on the chosen dictionary backend.

CAVEATS

Requires at least one backend (e.g., hunspell, aspell) installed; unrecognized options passed to backend; no built-in GUI.

INTERACTIVE MODE

Without FILE, reads stdin interactively: type text, ^D to end, navigate errors with commands like 'i' (insert), '?' (help).

EXAMPLES

enchant -L lists languages.
enchant -l en_US -G < words.txt suggests for words in file.
enchant document.txt checks file interactively.

HISTORY

Developed by Kevin Hendricks starting 2001 as part of Enchant library for AbiWord; command-line tool added early; maintained under GNU GPL, versions up to 2.x with improved backend support.

SEE ALSO

aspell(1), hunspell(1), ispell(1), spell(1)

Copied to clipboard