www.LinuxHowtos.org

edit this article

Spell Checking with Aspell

This tip demonstrates spell checking a file with aspell. While aspell comes with it's own dictionary, it also allows you to create and maintain a personal dictionary as well. There are many uses of aspell, but this time we are just going to look at interactively spell checking a file.

To install aspell, you need to install the aspell package and any language-based dictionaries you want aspell to check against (e.g. aspell-en).

Code Listing 1: Installing aspell and the English dictionary

# emerge app-text/aspell 
# emerge app-dicts/aspell-en
or
# apt-get install aspell
# apt-get install aspell-en

Now that aspell is installed, you can use it to check a document. Start by typing aspell check file, where file is the file you want to edit. If there are potentially misspelled words, you will see the the file and an option window at the bottom of your terminal. In the option window are suggested replacements and some options like ignore, replace, add, etc.

Code Listing 2: Using aspell

% aspell check tips-20031110.xml 
// file contents skipped...
secthead

1) sect head 6) scythed
2) sect-head 7) swathed
3) scathed 8) Scheat
4) seethed 9) soothed
5) sketched 0) secured
i) Ignore I) Ignore all
r) Replace R) Replace all
a) Add l) Add Lower
b) Abort x) Exit
? a
// secthead was added to my personal dictionary

--

Engliash

1) English 6) Anglia's
2) Englisher 7) Anglia
3) English's 8) Inglis
4) Englished 9) Anguish
5) Englishes 0) Unleash
i) Ignore I) Ignore all
r) Replace R) Replace all
a) Add l) Add Lower
b) Abort x) Exit

? 1
// The misspelled word was replaced with option 1) English

When Aspell finishes, you will see file.bak created as a backup copy of your document. To view your personal dictionary, use the command aspell dump personal. For more information, see http://aspell.sourceforge.net or use aspell --help.

From http://www.gentoo.org/news/en/gwn/20031110-newsletter.xml


rate this article:
current rating: average rating: 2.0 (175 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back