Loading TOC...


   $dictionary_uris as String[],
   $word as String,
   [$options as Object?]
) as Array


Suggests a list of spellings for a word. Returns an array of objects describing each suggestion, including the suggested word, the distance, the key distance, the word distance, and the levenshtein distance. You can use this extra information to make your own decisions about which suggestions to use. If you do not want to use this information, use the spell.suggest function instead.

$dictionary_uris The URIs of the dictionaries to use.
$word The word for which you get spelling suggestions.
$options The options node for this suggest operation. The default is null.

The spell.suggestDetailed options include:

Specifies the maximum number of suggestions to be returned. The default is 10.
Specifies a cut off threshold for suggestions having a distance less than the given number. The distance is a weighted number indicating the "distance" between two words, where lower numbers indicate a closer match. The default is 100, which means that distances less than or equal to 100 are considered as suggestions.

Usage Notes

The spell.suggestDetailed function is built-in and does not require importing any separate module.

The spell.suggestDetailed function only provides suggestions to words that are less than 64 characters in length; words 64 characters or longer return no suggestions. Also, it removes any dictionary entries that are 64 characters or more, so it will never return a suggestion with greater than 64 characters.

The keyDistance and wordDistance values in the output are used by the double metaphone algorithm to calculate the distance, which is a weighted number indicating how close a word is to the one in the dictionary.



=> ()



   <dictionary xmlns="http://marklogic.com/xdmp/spell">

// preparatory


// then run spell.suggestDetailed

		        "maximum": 5,
"original": "albatros",
"word": "albatross",
"dictionary": "/space/two-words.xml",
"distance": 9,
"keyDistance": 0,
"wordDistance": 45,
"levenshteinDistance": 1
"original": "albatros",
"word": "albatrosses",
"dictionary": "/space/two-words.xml",
"distance": 48,
"keyDistance": 1,
"wordDistance": 135,
"levenshteinDistance": 3


    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy