Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ SMAUG
➜ SMAUG coding
➜ Adding a spellchecker to smaug editor?
Adding a spellchecker to smaug editor?
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Robert Powell
Australia (367 posts) Bio
|
Date
| Tue 08 Jan 2008 09:07 AM (UTC) |
Message
| Has anyone ever done the above? I was having a discussion with someone the other day and they were asking if i was able to add one in.
Q. How hard would it be.
Q. Are there any C libraries that handle spell checking that would be easily added to the smaug editor.
Q. Is there a free US-English dictionary out there that could be redistributed with smaug and not have huqe license issues.
Q. Would it be be better to handle all of this by using linux commands in the shell.?
I would love to hear others takes on this. |
Just a guy having a bit of fun. Nothing more, nothing less, I do not need I WIN to feel validated. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 08 Jan 2008 07:43 PM (UTC) |
Message
| I don't think it would be too hard. Before making MUSHclient open-source I replaced the proprietary spell-checker (the same one used in the SMAUG editor) with a custom one I wrote mainly in Lua.
The dictionaries I found at an open-source dictionary site. Some are already available at this site in the MUSHclient downloads area:
http://www.gammon.com.au/files/mushclient/dicts.zip
To add the same thing into SMAUG you would basically grab the MUSHclient source, search for the parts that invoke the Lua spellchecker, and build those in. Since they were both written in C++ this shouldn't be too hard.
Basically you:
- Create a Lua script space when the program starts, and load the spellchecker file (the Lua file) into it, so it reads its dictionary.
- Release that script space at program close (probably not really necessary).
- Have a function that calls the Lua script when required.
See http://www.gammon.com.au/scripts/doc.php?general=spellcheck for the interfaces in MUSHclient.
I think I had to add a couple of extra functions to the Lua space (EditDistance and Metaphone), to help it build a list of suggested alternatives, if that was wanted.
The function in MUSHclient that spellchecks a string is:
http://www.gammon.com.au/scripts/doc.php?function=SpellCheck
There are almost certainly C libraries as well that could do it, and you could always call ispell from a shell script.
However I found my approach was reasonably fast and flexible, and at least I knew what I was doing and didn't need to install heaps of extra libraries and/or files to make it work.
You would be welcome to use the file spellchecker.lua that ships with MUSHclient - that does the reading in of the dictionaries, and compares your string of words to the dictionary.
Search the MUSHclient source for m_SpellChecker_Lua - that will find most of the references to the spell checking interface. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) Bio
Forum Administrator |
Date
| Reply #2 on Tue 08 Jan 2008 07:46 PM (UTC) |
Message
| I got the words from this site:
http://wordlist.sourceforge.net/
In particular, it was this file:
http://prdownloads.sourceforge.net/wordlist/scowl-6.tar.gz (2.23 Mb) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
14,193 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top