Loading TOC...

clang:stemmer

clang:stemmer(
   $variant as xs:string,
   [$normalization as xs:string?],
   [$args as item()*],
   [$library as xs:string]
) as element(lang:stemmer)

Summary

This function constructs a custom stemmer configuration item, suitable for use with clang:user-language-plugin.

Parameters
variant The name of a stemmer plugin, either one of the built-in stemmers or a user-defined lexer capability. The latter should be the name of a StemmerUDF capability registered by your plugin when MarkLogic calls Registry::registerStemmer.
normalization The normalization that should be used to present text runs to the plugin stemmer. Either "NFC" or "NFKD". Default: NFC.
args A sequence of arguments that will be passed to the initialization of the plugin stemmer as a sequence of strings.
library The name of the library containing variant. You should use an empty string when configuring a built-in plugin. If you omit this parameter, the library from the enclosing plugin configuration element is used. See the Usage Notes for details.

Usage Notes

If you specify a library name in clang:stemmer and when passing a stemmer to clang:user-language-plugin then the library in the stemmer configuration takes precedence over the library in the plugin configuration.

For a built-in stemmer, specify an empty string for the library name, or omit the library parameter and specify an empty string in clang:user-language-plugin.

For a user-defined plugin, the library name should be of the form plugin_path/plugin_id, such as "native/sample_plugin". If you omit this parameter, then the library value from clang:user-language-plugin will be used.

See Also

Example

(: Create a stemmer config item for a user-defined plugin, and pass
 : in a configuration option (keep-short-vowels). :)
xquery version "1.0-ml";
import module namespace clang = "http://marklogic.com/xdmp/custom-language" 
  at "/MarkLogic/custom-language.xqy";

clang:stemmer("special_stemmer", "NFC",
              ("keep-short-vowels=true"), "native/sampleplugin")
    

Example

(: Create a stemmer config item from a built-in plugin (bitext),
 : and pass in some configuration options. :)
xquery version "1.0-ml";
import module namespace clang = "http://marklogic.com/xdmp/custom-language" 
    at "/MarkLogic/custom-language.xqy";

clang:stemmer("bitext", (), ("algorithm=german2", "lowercase"), "")
  

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