Loading TOC...

spell functions

The table below lists all the spell built-in functions (in this namespace: http://marklogic.com/xdmp/spell).

You can also view these functions broken down by category:

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.

11 functions
Function name Description
spell.addWord Add the word $word to the dictionary at $uri.
spell.doubleMetaphone Given a word returns the two metaphone keys.
spell.insert Load the words in $dict into the dictionary at $uri.
spell.isCorrect Returns true() if the specified word is spelled correctly, otherwise returns false().
spell.levenshteinDistance Given two strings, returns the Levenshtein distance between those strings.
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.
spell.romanize Returns the romanization of the string, substituting basic Latin letters for the letters in the string, according to their sound.
spell.suggest Suggests a list of spellings for a word.
spell.suggestDetailed Suggests a list of spellings for a word.