Very Basic Spell Checker

So you have written that new, must have program. Let us see it here.
Post Reply
User avatar
Quincunxian
Posts: 171
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Very Basic Spell Checker

Post 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.
Attachments
SpellCheck.zip
(28.11 KiB) Downloaded 235 times
Cheers - Quin.
I code therefore I am
User avatar
BruceSteers
Posts: 1521
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Very Basic Spell Checker

Post 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.
If at first you don't succeed , try doing something differently.
BruceS
Post Reply