[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  Adding a spellchecker to smaug editor?

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: Adding a spellchecker to smaug editor?
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Tue 08 Jan 2008 07:46 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Tue 08 Jan 2008 07:43 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Robert Powell   Australia  (349 posts)  [Biography] bio
Date Tue 08 Jan 2008 09:07 AM (UTC)  quote  ]
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.

EldhaMUD Game Developments
The_Fury: Lead Developer, Head Coder
http://fury.eldhamud2.org
[Go to top] 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.


2,320 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]