NWNX:EE  8193.37.14
SpellChecker

Readme

Spell checking through Hunspell 1.4.1 and up

How to install?

Note: More heavily tested on 1.4.1 but works on 1.6.

Hunspell is installed by default on some systems, if it's not: sudo apt-get install libhunspell-1.4-0:i386

If you wish to build (which you likely do if you're here) This also includes the necessary files above sudo apt-get install libhunspell-dev:i386

Alternatively, you can find hunspell's source here: https://github.com/hunspell/hunspell/releases

For easily installed dictionary list:

apt-cache search hunspell

sudo apt-get install hunspell-en-us for English (United States)

The package requires a 32-bit version of libhunspell.so

If this doesn't exist with your OS's i386 libraries and you have libhunspell 1.4 or above installed try running:

Example for Debian: sudo ln -s /usr/lib/i386-linux-gnu/libhunspell-1.4.so.0 /usr/lib/i386-linux-gnu/libhunspell.so

You can also use the above method to update hunspell to a newer version (may not be supported)

Environment Variables

NWNX_SPELL_PATH_AFF [optional]: The path to the aff file. By default /usr/share/hunspell/en_US.aff is used.
NWNX_SPELL_PATH_DIC [optional]: The path to the dic file. By default /usr/share/hunspell/en_US.dic is used.

Files

file  nwnx_spellcheck.nss
 

Functions

string NWNX_SpellChecker_FindMisspell (string sentence)
 Finds misspells in a string. More...
 
string NWNX_SpellChecker_GetSuggestSpell (string word)
 Get suggestions on a single word, comma delimited. More...
 

Function Documentation

◆ NWNX_SpellChecker_FindMisspell()

string NWNX_SpellChecker_FindMisspell ( string  sentence)

Finds misspells in a string.

Parameters
sentenceThe sentence to check.
Returns
The spelling mistakes in the sentence, comma delimited. Returns blank if no errors or if .so file is improperly installed.
Note
If it returns an error in every word, even when spelled correctly, the dictionary is not set up correctly.
Warning
These functions can be performance heavy, do limit how many calls and/or how long of a sentence is passed. Make use of DelayCommands and AssignCommands

Definition at line 27 of file nwnx_spellcheck.nss.

◆ NWNX_SpellChecker_GetSuggestSpell()

string NWNX_SpellChecker_GetSuggestSpell ( string  word)

Get suggestions on a single word, comma delimited.

Parameters
wordThe string to check for suggestions.
Returns
A comma delimited lists of suggestions for a word. Returns blank if no errors or if .so file is improperly installed.
Warning
These functions can be performance heavy, do limit how many calls and/or how long of a sentence is passed. Make use of DelayCommands and AssignCommands

Definition at line 34 of file nwnx_spellcheck.nss.