SpellCheck (re-inventing the wheel)
James Hurley
jhurley at infostations.com
Fri Jan 28 10:43:23 EST 2005
>
>Message: 11
>Date: Fri, 28 Jan 2005 01:14:02 +0000
>From: Alex Tweedly <alex at tweedly.net>
>Subject: Re: SpellCheck (re-inventing the wheel)
>To: How to use Revolution <use-revolution at lists.runrev.com>
>Message-ID: <41F991DA.20403 at tweedly.net>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Then I tried a slightly more complex way:
>setup
>
> > put url ("file:" & tFile) into gWords
>> repeat for each word w in gWords
>> put 1 into gArray[w]
>> end repeat
>
>and then
>
>> put tWords into field "inField"
>> put 0 into t
>> repeat for each word w in tWords
>> add 1 to t
>> replace "." with empty in w
>> replace "," with empty in w
>> replace "!" with empty in w
>> if gArray[w] <> 1 then
>> set the textstyle of word t of field "inField" to "bold"
>> end if
> > end repeat
>
>This took 2 millisecs for 50 words, so would be reasonable for even
>large-ish documents.
>
>I tried to put this sample stack onto RevOnline - but I'm having some
>problem connecting to the server, so you can find it instead at
> www.tweedly.net/RunRev/SpellCheck.rev
> www.tweedly.net/RunRev/allwords.dic
>(remember the dic is 1.75M - don't download it unless you really want it !)
>
>-- Alex.
>
Alex,
Coming from FORTRAN, I have never really appreciated the more
flexible use of arrays in Runtime Revolution. Your solution to the
spell check problem is a Runtime revelation.
However a naive question: Since you only use the gArray, would it be
possible somehow to store the information in the gArray in a file (I
don't mean store all the 1's), and use that directly in the repeat
loop, rather than store the dictionary gWords in a file and then have
to construct the gArray?
Jim
More information about the use-livecode
mailing list