From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3851 invoked by alias); 27 Oct 2014 11:19:00 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19297 Received: (qmail 18426 invoked from network); 27 Oct 2014 11:18:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Date: Mon, 27 Oct 2014 12:18:42 +0100 From: Eric Smith To: zsh-users@zsh.org Subject: Re: spell check on the command line Message-ID: References: <141024083614.ZM20933@torch.brasslantern.com> <141025002453.ZM22210@torch.brasslantern.com> <141025110602.ZM23153@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <141025110602.ZM23153@torch.brasslantern.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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