The spelling functions are designed to help you manage dictionary documents in MarkLogic Server. You can create dictionary documents in both JSON and XML formats. The spelling function module is installed as the following file:
install_dir/Modules/MarkLogic/spell.xqy
where install_dir
is the directory in which
MarkLogic Server is installed.
To use the spell
module in your own Server-Side JavaScript
modules, include the following line in your JavaScript program:
const spell = require("/MarkLogic/spell");
The spelling correction functions (spell.isCorrect
and
spell.suggest
) are built-in functions and do not require the
require
statement in your JavaScript code.
There are also Spell Built-In functions, which you use to check if words are spelled correctly according to the dictionaries and to suggest alternate spellings.
Function name | Description |
---|---|
spell.addWord | Add the word $word to the dictionary at $uri. |
spell.insert | Load the words in $dict into the dictionary at $uri. |
spell.load | Add the words from the file specified in $path to the dictionary at $uri. |
spell.makeDictionary | Creates a dictionary node from a sequence of words. |
spell.removeWord | Remove the word $word from the dictionary at $uri. |