use of java.text.BreakIterator in project lucene-solr by apache.
the class TestCustomSeparatorBreakIterator method testSliceEnd.
public void testSliceEnd() throws Exception {
BreakIterator expected = BreakIterator.getSentenceInstance(Locale.ROOT);
BreakIterator actual = new CustomSeparatorBreakIterator(randomSeparator());
assertSameBreaks("a000", 0, 1, expected, actual);
assertSameBreaks("ab000", 0, 1, expected, actual);
assertSameBreaks("abc000", 0, 1, expected, actual);
assertSameBreaks("000", 0, 0, expected, actual);
}
use of java.text.BreakIterator in project lucene-solr by apache.
the class TestCustomSeparatorBreakIterator method testSliceStart.
public void testSliceStart() throws Exception {
BreakIterator expected = BreakIterator.getSentenceInstance(Locale.ROOT);
BreakIterator actual = new CustomSeparatorBreakIterator(randomSeparator());
assertSameBreaks("000a", 3, 1, expected, actual);
assertSameBreaks("000ab", 3, 2, expected, actual);
assertSameBreaks("000abc", 3, 3, expected, actual);
assertSameBreaks("000", 3, 0, expected, actual);
}
use of java.text.BreakIterator in project lucene-solr by apache.
the class TestCustomSeparatorBreakIterator method testFirstPosition.
/** the current position must be ignored, initial position is always first() */
public void testFirstPosition() throws Exception {
BreakIterator expected = BreakIterator.getSentenceInstance(Locale.ROOT);
BreakIterator actual = new CustomSeparatorBreakIterator(randomSeparator());
assertSameBreaks("000ab000", 3, 2, 4, expected, actual);
}
use of java.text.BreakIterator in project lucene-solr by apache.
the class BreakIteratorBoundaryScannerTest method testWordBoundary.
public void testWordBoundary() throws Exception {
StringBuilder text = new StringBuilder(TEXT);
BreakIterator bi = BreakIterator.getWordInstance(Locale.ROOT);
BoundaryScanner scanner = new BreakIteratorBoundaryScanner(bi);
int start = TEXT.indexOf("formance");
int expected = TEXT.indexOf("high-performance");
testFindStartOffset(text, start, expected, scanner);
expected = TEXT.indexOf(", full");
testFindEndOffset(text, start, expected, scanner);
}
use of java.text.BreakIterator in project lucene-solr by apache.
the class TestWholeBreakIterator method testSliceStart.
public void testSliceStart() throws Exception {
BreakIterator expected = BreakIterator.getSentenceInstance(Locale.ROOT);
BreakIterator actual = new WholeBreakIterator();
assertSameBreaks("000a", 3, 1, expected, actual);
assertSameBreaks("000ab", 3, 2, expected, actual);
assertSameBreaks("000abc", 3, 3, expected, actual);
assertSameBreaks("000", 3, 0, expected, actual);
}
Aggregations