Search in sources :

Example 21 with SimpleLinguistics

use of com.yahoo.language.simple.SimpleLinguistics in project vespa by vespa-engine.

the class MinimalQueryInserterTestCase method setUp.

@Before
public void setUp() throws Exception {
    searchChain = new Chain<>(new MinimalQueryInserter());
    context = Execution.Context.createContextStub(null, null, new SimpleLinguistics());
    execution = new Execution(searchChain, context);
}
Also used : SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) Execution(com.yahoo.search.searchchain.Execution) Before(org.junit.Before)

Example 22 with SimpleLinguistics

use of com.yahoo.language.simple.SimpleLinguistics in project vespa by vespa-engine.

the class NormalizeTestCase method requireThatHashCodeAndEqualsAreImplemented.

@Test
public void requireThatHashCodeAndEqualsAreImplemented() {
    Linguistics linguistics = new SimpleLinguistics();
    NormalizeExpression exp = new NormalizeExpression(linguistics);
    assertFalse(exp.equals(new Object()));
    assertFalse(exp.equals(new NormalizeExpression(Mockito.mock(Linguistics.class))));
    assertEquals(exp, new NormalizeExpression(linguistics));
    assertEquals(exp.hashCode(), new NormalizeExpression(linguistics).hashCode());
}
Also used : SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) Linguistics(com.yahoo.language.Linguistics) SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) Test(org.junit.Test)

Example 23 with SimpleLinguistics

use of com.yahoo.language.simple.SimpleLinguistics in project vespa by vespa-engine.

the class NormalizeTestCase method requireThatAccessorsWork.

@Test
public void requireThatAccessorsWork() {
    Linguistics linguistics = new SimpleLinguistics();
    NormalizeExpression exp = new NormalizeExpression(linguistics);
    assertSame(linguistics, exp.getLinguistics());
}
Also used : SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) Linguistics(com.yahoo.language.Linguistics) SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) Test(org.junit.Test)

Example 24 with SimpleLinguistics

use of com.yahoo.language.simple.SimpleLinguistics in project vespa by vespa-engine.

the class NormalizeTestCase method requireThatExpressionCanBeVerified.

@Test
public void requireThatExpressionCanBeVerified() {
    Expression exp = new NormalizeExpression(new SimpleLinguistics());
    assertVerify(DataType.STRING, exp, DataType.STRING);
    assertVerifyThrows(null, exp, "Expected string input, got null.");
    assertVerifyThrows(DataType.INT, exp, "Expected string input, got int.");
}
Also used : SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) Test(org.junit.Test)

Example 25 with SimpleLinguistics

use of com.yahoo.language.simple.SimpleLinguistics in project vespa by vespa-engine.

the class TokenizeTestCase method requireThatHashCodeAndEqualsAreImplemented.

@Test
public void requireThatHashCodeAndEqualsAreImplemented() {
    AnnotatorConfig config = new AnnotatorConfig().setLanguage(Language.ARABIC);
    Expression exp = new TokenizeExpression(new SimpleLinguistics(), config);
    assertFalse(exp.equals(new Object()));
    assertFalse(exp.equals(new TokenizeExpression(Mockito.mock(Linguistics.class), new AnnotatorConfig().setLanguage(Language.SPANISH))));
    assertFalse(exp.equals(new TokenizeExpression(new SimpleLinguistics(), new AnnotatorConfig().setLanguage(Language.SPANISH))));
    assertEquals(exp, new TokenizeExpression(new SimpleLinguistics(), config));
    assertEquals(exp.hashCode(), new TokenizeExpression(new SimpleLinguistics(), config).hashCode());
}
Also used : SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) AnnotatorConfig(com.yahoo.vespa.indexinglanguage.linguistics.AnnotatorConfig) Linguistics(com.yahoo.language.Linguistics) SimpleLinguistics(com.yahoo.language.simple.SimpleLinguistics) Test(org.junit.Test)

Aggregations

SimpleLinguistics (com.yahoo.language.simple.SimpleLinguistics)42 Test (org.junit.Test)37 Token (com.yahoo.prelude.query.parser.Token)17 Tokenizer (com.yahoo.prelude.query.parser.Tokenizer)17 Linguistics (com.yahoo.language.Linguistics)10 Index (com.yahoo.prelude.Index)7 IndexFacts (com.yahoo.prelude.IndexFacts)7 StringFieldValue (com.yahoo.document.datatypes.StringFieldValue)6 AnnotatorConfig (com.yahoo.vespa.indexinglanguage.linguistics.AnnotatorConfig)5 SpecialTokenRegistry (com.yahoo.prelude.query.parser.SpecialTokenRegistry)3 Query (com.yahoo.search.Query)3 Execution (com.yahoo.search.searchchain.Execution)3 SimpleTestAdapter (com.yahoo.vespa.indexinglanguage.SimpleTestAdapter)3 InputExpression (com.yahoo.vespa.indexinglanguage.expressions.InputExpression)3 Pair (com.yahoo.collections.Pair)2 FieldValue (com.yahoo.document.datatypes.FieldValue)2 IntegerFieldValue (com.yahoo.document.datatypes.IntegerFieldValue)2 RendererRegistry (com.yahoo.search.rendering.RendererRegistry)2 ArithmeticExpression (com.yahoo.vespa.indexinglanguage.expressions.ArithmeticExpression)2 AttributeExpression (com.yahoo.vespa.indexinglanguage.expressions.AttributeExpression)2