Loading TOC...

cdict.dictionaryRead

cdict.dictionaryRead(
   $lang as String,
   [$tokenization as Boolean]
) as element(cdict.dictionary)?

Summary

Retrieve the custom dictionary for a language.

Parameters
$lang The ISO language code of the dictionary.
$tokenization Whether to read the tokenization dictionary or the stemming dictionary for the specified language. Set to true for tokenization, false for stemming. Default: false (stemming). This parameter is ignored for languages that use a single dictionary for both stemming and tokenization, such as Japanese and Chinese.

Required Privileges

This function requires the custom-dictionary-user or the following privileges:

http://marklogic.com/xdmp/privileges/custom-dictionary-user

Usage Notes

If no custom dictionary is configured for the specified language and dictionary type combination, this function returns an empty sequence.

The returned dictionary element will have an xml:lang attribute indicating the language.

See Also

Example

const cdict = require('/MarkLogic/custom-dictionary');
cdict.dictionaryRead('en');

/* Returns a dictionary similar to the following:
  <cdict:dictionary 
      xmlns:cdict="http://marklogic.com/xdmp/custom-dictionary"
      xml:lang="en">
    <cdict:entry>
      <cdict:word>Furbies</cdict:word>
      <cdict:stem>Furby</cdict:stem>
    </cdict:entry>
    <cdict:entry>
      <cdict:word>servlets</cdict:word>
      <cdict:stem>servlet</cdict:stem>
    </cdict:entry>
  </cdict:dictionary>
*/
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.