Spurred on by Reichart's comment [on Rebol/Ahem] about a Rebol Spell Checker
and Corrector being needed and needing one myself for my eText project
(plain text with human understandable formatting into HTML), I wrote up this
quick spell checker. Unfortunately, it doesn't work yet. I really need to
know what Rebol word I need to put in the "action" block for the buttons to
"continue" or "exit" the "view layout" part. Also, what word is used to
retrieve the text from the 'Correction field? Does anyone know these?

Thank you for your help.

[
Rebol [
    Name: 'Spell
    Title: "Spell Checker and Corrector"
    File: %Spell.r
    Author: "Andrew Martin"
    eMail: [EMAIL PROTECTED]
    Date: 19/Jan/2001
    ]

Spell!: make object! [
    Directory: %Spell/
    if not exists? Directory [md Directory]
    Dictionary: make block! 0
    error? try [Dictionary: sort load Directory/Dictionary.txt]
    Lower: charset [#"a" - #"z"]
    Upper: charset [#"A" - #"Z"]
    Alpha: union Upper Lower
    set 'Spell function [Text [string!]][Word WordStart WordEnd][
        parse/all Text [
            some [
                WordStart: [some Alpha opt [[{'} | {-}] some Alpha]]
WordEnd: (
                    Word: copy/part WordStart WordEnd
                    if not found? find Dictionary Word [
                        view layout [
                            h1 "Spell"
                            h2 "Miss-spelled word?"
                            across
                            text Word Add: button 200 "Add to Dictionary"
[append Dictionary Word] return
                            text "Correction: " Correction: field return
                            button "Cancel" button "OK" []
                            ]
                        ]
                    )
                | skip
                ]
            ]
        Text
        ]
    ]

Spell "hello"

]

Andrew Martin
ICQ: 26227169 http://members.nbci.com/AndrewMartin/
-><-


-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to