GNUAspell / aspell

http://aspell.net
GNU Lesser General Public License v2.1
243 stars 52 forks source link

Aspell pipe - return after first spell check #105

Open aspell-helper opened 21 years ago

aspell-helper commented 21 years ago

Robert Walker robertwalker\@sf created a feature request on 2003-09-04 01:32:55 UTC (Orig. from https://sourceforge.net/p/aspell/feature-requests/25)

Hi there,

I'm working on a program to spell check a document that user can edit interactively as in Word.

It would be really useful if Aspell in piped mode could return immediately after the first spelling suggestion for the sentence.

So if the sentence has many spelling mistakes, it needs to return immediately after the first one and not go on and examine the remaining ones.

Suggestion e.g. use ^^ instead of ^ or some other symbol then,

^^the quick brown fox jmps ove the lzy dog should spell check only as far as the "jmps" spelling mistake there and then return the data for that word only.

The reason for this is that I need to pass data to Aspell via the pipe and it is best to send a lot at a time - transmission of the data is fast. But don't want Aspell to spell check all the word as then calling program would have to way a number of seconds for it to return all the spelling suggestions for all of them. Just the first one is needed.

Typically in a Windows GUI based spell checker, user clicks Spell Check next, then the spell checker will go forward to the next spelling mistake and pop up a list of suggestions. User then accepts or not - but then can pause, edit the document and change it anywhere, copy, paste, multiple undo, can do anything really before going on to check the next one. So any later data os best assumed to be invalid by the time of the next spell check - no point in finding or retaining it. Ony slows things down.

Aspell is fast to skip through correct words and slower to do the suggestions lists so stopping at first suggestions list would make it far faster. The only work around so far I found is to spell check one word at a time. Even two words at a time will sometimes mean it waits twice as long as it needs too. So sending by blocks is inapporpriate

The command line model isn't appropriate here as the user can change any part of document at any time, paste text from another program, undo changes etc.

All the programmer has available is the position of the caret (text cursor) in the text and the current text for the document, doesn't know what got changed.

Not high priority at all - it works fine as it is but will be a bit faster with this feature, so if it is easy to code please do. I think other W32 developers aiming to code similar projects will find it useful too.

Thanks.

Robert

aspell-helper commented 21 years ago

Robert Walker robertwalker\@sf updated the issue on 2003-09-04 01:35:22 UTC

aspell-helper commented 21 years ago

Robert Walker robertwalker\@sf commented on 2003-09-04 01:39:23 UTC

Logged In: YES user_id=823361

Just to explain:

When using in the gui the way it works is that the user clicks anywhere in the document to set the caret there. Then the spell check will proceed forward through the document from teh current position of the caret - so the data the calling program would send to Aspell through the pipe would be the rest of the document after the caret and Aspell then should return with information about the first spelling mistake in that chunk.

Unless the document is really large, hundreds of KB then the size of the string to be sent to Aspell is of no consideration for speed as sending it is near instantaneous.

aspell-helper commented 21 years ago

Kevin Atkinson kevina\@sf updated the issue on 2003-09-07 18:48:39 UTC