Jump to content

spell checker in Perl? with Aspell?


Guest quakey
 Share

Recommended Posts

Guest quakey

Hi,

 

I want to check spelling of a word in Perl and how do I do that? I wanted to use Aspell but it doesn't seem to have a command-line mode that would just check a word and tells if the word is spell correctly or not.

 

I looked at the Aspell options, but there doesn't seem to be a way to do things like:

 

aspell "checkthisword"

 

in the command-line and return something telling me if the word is spelled correctly. It does take in a file and check the words but it also goes into a "screen" that display more options than I need. Am I missing something here?

 

Thank you.

Link to comment
Share on other sites

You can use aspell to check a word or list from STDIN like this:

 

 echo "luzer" | aspell -l

 

If the word is spelled correctly, it returns nothing. If it is spelled incorrectly, it returns the word. No suggestions at all as to how to spell it, though.

 

Also you can just do

 

aspell -l [hit enter]

[type a bunch of words here and hit Ctrl-D when you are done. It only returns the words that are spelled incorrectly. Once again, no suggestions]

Link to comment
Share on other sites

Steve's usage sounds like just what you need - just an indication that it is spelled correctly. To comment on the " No suggestions at all as to how to spell it, though. ", there is an option in ispell, so I imagine aspell has it:

 

terry@timestorm: /home/terry

21:45:56 $ echo "loooser luzer lazer atari linux" | ispell -a

@(#) International Ispell Version 3.2.06 08/01/01

& loooser 1 0: looser

& luzer 2 8: luger, lurer

& lazer 15 14: blazer, gazer, glazer, hazer, lacer, lager, laker, lamer, laser, later, layer, lazed, lazier, mazer, razer

& atari 1 20: Atari

& linux 2 26: Linus, Linux

 

Note that it will show you proper capitalization, too

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...