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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.semantics.test;
import org.junit.Test;
/**
* Tests anchoring
*
* @author bratseth
*/
public class AnchorTestCase extends RuleBaseAbstractTestCase {
public AnchorTestCase() {
super("anchor.sr");
}
@Test
public void testSingleWordAnchoredBothSides() {
assertSemantics("anchor", "word");
assertSemantics("anchor", "anotherword");
assertSemantics("notthisword", "notthisword");
assertSemantics("AND word anotherword", "word anotherword");
}
@Test
public void testMultiwordAnchored() {
assertSemantics("anchor", "this is complete");
assertSemantics("AND this is complete toomuch", "this is complete toomuch");
assertSemantics("anchor", "a phrase");
assertSemantics("anchor", "another phrase");
}
@Test
public void testFirstAnchored() {
assertSemantics("anchor","first");
assertSemantics("AND anchor andmore","first andmore");
assertSemantics("AND before first","before first");
assertSemantics("AND before first andmore","before first andmore");
}
@Test
public void testLastAnchored() {
assertSemantics("anchor","last");
assertSemantics("AND andmore anchor","andmore last");
assertSemantics("AND last after","last after");
assertSemantics("AND andmore last after","andmore last after");
}
@Test
public void testFirstAndLastAnchored() {
assertSemantics("AND anchor anchor","first last");
assertSemantics("AND last first","last first");
assertSemantics("AND anchor between anchor","first between last");
assertSemantics("AND anchor last after","first last after");
assertSemantics("AND before first anchor","before first last");
}
}
|