aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude/query/parser/TestLinguistics.java
blob: b8eb6e2dec5966c29995af7da8a2bece2cf8e820 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.query.parser;

import com.yahoo.collections.Tuple2;
import com.yahoo.component.Version;
import com.yahoo.language.Linguistics;
import com.yahoo.language.detect.Detector;
import com.yahoo.language.process.*;
import com.yahoo.language.simple.SimpleLinguistics;

/**
 * @author Simon Thoresen Hult
 */
public class TestLinguistics implements Linguistics {

    public static final Linguistics INSTANCE = new TestLinguistics();
    private final Linguistics linguistics = new SimpleLinguistics();

    private TestLinguistics() {
        // hide
    }

    @Override
    public Stemmer getStemmer() {
        return linguistics.getStemmer();
    }

    @Override
    public com.yahoo.language.process.Tokenizer getTokenizer() {
        return linguistics.getTokenizer();
    }

    @Override
    public Normalizer getNormalizer() {
        return linguistics.getNormalizer();
    }

    @Override
    public Transformer getTransformer() {
        return linguistics.getTransformer();
    }

    @Override
    public Segmenter getSegmenter() {
        return new TestSegmenter();
    }

    @Override
    public Detector getDetector() {
        return linguistics.getDetector();
    }

    @Override
    public GramSplitter getGramSplitter() {
        return linguistics.getGramSplitter();
    }

    @Override
    public CharacterClasses getCharacterClasses() {
        return linguistics.getCharacterClasses();
    }

    public boolean equals(Linguistics other) {
        return (other instanceof TestLinguistics);
    }

}