Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: spell check on the command line
Thanks Bart.
All works first time.
(Perhaps one day I will actually become literate and learn to spell, perhaps not?)
ciao
Eric Smith
Bart Schaefer wrote on Sat-25-Oct 14 8:06PM
> On Oct 25, 10:17am, Eric Smith wrote:
> }
> } I cannot find the application "suggest" anywhere, what do you
> } suggest?
>
> No pun intended?
>
> If you have ispell or aspell you can run them with the -a option and
> parse the output. I'm sure there's a way to do the same with hunspell
> but I'm not familiar with the details.
>
> It'd be something like
>
> suggest() {
> local tag misspelt count offset suggestions
> aspell -a |
> while read tag misspelt count offset suggestions
> do
> [[ $tag = \& ]] && print -R $misspelt ${${(s:, :)suggestions}[1]}
> done
> }
>
> Beware that aspell might suggest that a word be split into two words,
> rather than corrected to a different single word, so you probably want
> to adjust the above to filter ${(s:, :)suggestions} before deciding
> which one to print.
>
> --
> Barton E. Schaefer
--
Eric Smith
Messages sorted by:
Reverse Date,
Date,
Thread,
Author