Loading TOC...

MarkLogic Server 11.0 Product Documentation
cdict:dictionary-read

cdict:dictionary-read(
   $lang as xs:string,
   [$tokenization as xs: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

  xquery version "1.0-ml";
  import module namespace cdict = "http://marklogic.com/xdmp/custom-dictionary" 
		  at "/MarkLogic/custom-dictionary.xqy";

  cdict:dictionary-read("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.