Loading TOC...

MarkLogic Server 11.0 Product Documentation
clang.stemmer

clang.stemmer(
   variant as String,
   [normalization as String?],
   [args as Sequence],
   [library as String]
) as element(lang.stemmer)

Summary

This function constructs a custom stemmer configuration item, suitable for use with clang.userLanguagePlugin.

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.userLanguagePlugin 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.userLanguagePlugin.

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.userLanguagePlugin 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).
'use strict';
const clang = require('/MarkLogic/custom-language');

clang.stemmer('special_stemmer', 'NFC', 
              Sequence.from(['keep-short-vowels=true']), 'native/sampleplugin');
    

Example

// Create a stemmer config item from a user-defined plugin (bitext), and
// pass in some configuration options.
'use strict';
const clang = require('/MarkLogic/custom-language');

clang:stemmer('bitext', null, 
            Sequence.from(['algorithm=german2', 'lowercase']), '')
    

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