Page 1 of 1

Very Basic Spell Checker

Posted: Tuesday 10th August 2021 11:24am
by Quincunxian
I've been trying to create a basic spell check for a larger gambas project I'm working on, and this is what I have so far.
It's clunky but workable (for a given value of workable :roll: )

It uses the command line tool 'spell', which is part of ispell application from what I understand.

The attached sample project has a text edit box and provides some correctly and incorrectly spelled words for a test.
Click the Spell Check Button and it will present a list of the words that are miss spelled.
Click on the word and it will highlight it in the textedit control and open google to search for the word.
Using google is not optimal, but I can't find a command line tool that will return a list of suggestions for the word.

What it does:
It saves the displayed text in a file and then shells out to spell. The parses that file word by word.
If it finds a correct spelling, it ignores the word.
If it finds an incorrectly spelled word it outputs it on a new line.
I have redirected this output to another temp file which I read in and add line by line to a Listbox.

You can highlight a word in the text by clicking on the word which will also open google with the search q=spell+{word}

If you click on and drag the blue bar of the spellcheck panel, you can move it around the screen.
If you then click on the Textedit control, the spellcheck panel will become invisible.

I did a test on some text that was around 8000 words and it returned the list in less than a second - it's quite fast.

Re: Very Basic Spell Checker

Posted: Tuesday 10th August 2021 10:25pm
by BruceSteers
Hi Quin will check that out.

You need to use the command ispell for suggestions..
I found this info...

Spell and Ispell

spell is essentially a wrapper for the much more complex ispell utility. However, unlike ispell (or the very similar GNU program, aspell), spell does not make any spelling suggestions. It only reports which words were misspelled.