Search in sources :

Example 1 with LinguisticsAnnotator

use of com.yahoo.vespa.indexinglanguage.linguistics.LinguisticsAnnotator in project vespa by vespa-engine.

the class TokenizeExpression method doExecute.

@Override
protected void doExecute(ExecutionContext context) {
    StringFieldValue input = (StringFieldValue) context.getValue();
    StringFieldValue output = input.clone();
    context.setValue(output);
    AnnotatorConfig cfg = new AnnotatorConfig(config);
    Language lang = context.resolveLanguage(linguistics);
    if (lang != null) {
        cfg.setLanguage(lang);
    }
    LinguisticsAnnotator annotator = new LinguisticsAnnotator(linguistics, cfg);
    annotator.annotate(output);
}
Also used : AnnotatorConfig(com.yahoo.vespa.indexinglanguage.linguistics.AnnotatorConfig) Language(com.yahoo.language.Language) StringFieldValue(com.yahoo.document.datatypes.StringFieldValue) LinguisticsAnnotator(com.yahoo.vespa.indexinglanguage.linguistics.LinguisticsAnnotator)

Aggregations

StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)1 Language (com.yahoo.language.Language)1 AnnotatorConfig (com.yahoo.vespa.indexinglanguage.linguistics.AnnotatorConfig)1 LinguisticsAnnotator (com.yahoo.vespa.indexinglanguage.linguistics.LinguisticsAnnotator)1