aboutsummaryrefslogtreecommitdiffstats
path: root/opennlp-linguistics/src/main/java/com/yahoo/language/opennlp/LanguageDetectorFactory.java
blob: 517e3f96d81e54ec8a21a4307a054e7787ecab75 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.language.opennlp;

import opennlp.tools.langdetect.LanguageDetectorContextGenerator;

/**
 * Overrides the UrlCharSequenceNormalizer, which has a bad regex, until fixed: https://issues.apache.org/jira/browse/OPENNLP-1350
 *
 * @author jonmv
 */
@SuppressWarnings("unused") // Loaded by black magic: specified in properties in the loaded model.
public class LanguageDetectorFactory extends opennlp.tools.langdetect.LanguageDetectorFactory {

    @Override
    public LanguageDetectorContextGenerator getContextGenerator() {
        return new DefaultLanguageDetectorContextGenerator(1, 3,
                                                           VespaCharSequenceNormalizer.getInstance());
    }

}