Loading TOC...

MarkLogic 12 EA 2 Product Documentation
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.xqy module in your own XQuery modules, include the following line in your XQuery prolog:

import module namespace spell = "http://marklogic.com/xdmp/spell" at "/MarkLogic/spell.xqy";

The library uses the spell: namespace, predefined in the server.

The spelling correction functions (spell:is-correct and spell:suggest) are built-in functions and do not require the import module statement in the XQuery prolog.

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:add-word Add the word $word to the dictionary at $uri.
spell:double-metaphone Given a word returns the two metaphone keys.
spell:insert Load the words in $dict into the dictionary at $uri.
spell:is-correct Returns true() if the specified word is spelled correctly, otherwise returns false().
spell:levenshtein-distance 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:make-dictionary Creates a dictionary node from a sequence of words.
spell:remove-word 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:suggest-detailed Suggests a list of spellings for a word.