|
|
spell:suggest(
|
|
$uri as xs:string*,
|
|
$word as xs:string,
|
|
[$options as node()?]
|
| ) as xs:string* |
|
 |
Summary:
Suggests a list of spellings for a word. Returns a sequence of the most
likely spellings for the specified word.
|
Parameters:
$uri
:
The URIs of the dictionaries to use.
|
$word
:
The word for which you get spelling suggestions.
|
$options
(optional):
The options node for this suggest operation. The default is ().
The node for the spell:suggest options must be in the
http://marklogic.com/xdmp/spell namespace.
The spell:suggest options include:
<maximum>
- Specifies the maximum number of suggestions to be returned.
The default is 10.
<distance-threshold>
- Specifies a cut off threshold for suggestions having a distance
less than the given number. The default is 100.
|
|
Usage Notes:
The spell:suggest function is a built-in function and
does not require the import module statement in the XQuery
prolog.
The spell:suggest 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.
|
Example:
spell:suggest("myDictionary.xml","occasionally")
=> occasionally occasional occasion occasions occasion's
occasioned optionally educationally irrationally
|
Example:
spell:suggest("spell.xml", "albetros")
=> albatross abettors alders alters Albert's Elbert's
allegros alder's Walters abettor's
|
|
|
|
spell:suggest-detailed(
|
|
$uri as xs:string*,
|
|
$word as xs:string,
|
|
[$options as node()?]
|
| ) as element(spell:suggestion)* |
|
 |
Summary:
Suggests a list of spellings for a word. Returns a sequence of elements
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.
|
Parameters:
$uri
:
The URIs of the dictionaries to use.
|
$word
:
The word for which you get spelling suggestions.
|
$options
(optional):
The options node for this suggest operation. The default is ().
The node for the spell:suggest-detailed options must be in the
http://marklogic.com/xdmp/spell namespace.
The spell:suggest-detailed options include:
<maximum>
- Specifies the maximum number of suggestions to be returned.
The default is 10.
<distance-threshold>
- 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:suggest-detailed function is a built-in
function and does not require the import module statement
in the XQuery prolog.
The spell:suggest-detailed 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 key-distance and word-distance 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.
|
Example:
spell:suggest-detailed("myDictionary.xml","occasionally")
=> ()
|
Example:
spell:suggest-detailed("spell.xml", "albetros")
=>
<spell:suggestion original="albetros" dictionary="spell.xml">
<spell:word
distance="26"
key-distance="0"
word-distance="95"
levenshtein-distance="2">
albatross
</spell:word>
</spell:suggestion>
|
|
|