本文整理汇总了Java中org.galagosearch.core.util.ExtentArray类的典型用法代码示例。如果您正苦于以下问题:Java ExtentArray类的具体用法?Java ExtentArray怎么用?Java ExtentArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExtentArray类属于org.galagosearch.core.util包,在下文中一共展示了ExtentArray类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTwoExtents
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public void testTwoExtents() {
ExtentArray array = new ExtentArray();
array.add( 1, 5, 7 );
array.add( 1, 9, 11 );
ExtentArrayIterator instance = new ExtentArrayIterator( array );
assertFalse( instance.isDone() );
assertEquals( instance.current().document, 1 );
assertEquals( instance.current().begin, 5 );
assertEquals( instance.current().end, 7 );
instance.next();
assertFalse( instance.isDone() );
assertEquals( instance.current().document, 1 );
assertEquals( instance.current().begin, 9 );
assertEquals( instance.current().end, 11 );
instance.next();
assertTrue( instance.isDone() );
}
示例2: testPhrase
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public void testPhrase() throws IOException {
int[][] dataOne = {{1, 3}};
int[][] dataTwo = {{1, 4}};
FakeExtentIterator one = new FakeExtentIterator(dataOne);
FakeExtentIterator two = new FakeExtentIterator(dataTwo);
FakeExtentIterator[] iters = { one, two };
Parameters oneParam = new Parameters();
oneParam.add("width", "1");
OrderedWindowIterator instance = new OrderedWindowIterator(oneParam, iters);
ExtentArray array = instance.extents();
assertEquals(array.getPosition(), 1);
assertEquals(array.getBuffer()[0].document, 1);
assertEquals(array.getBuffer()[0].begin, 3);
assertEquals(array.getBuffer()[0].end, 5);
}
示例3: testPhrase
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public void testPhrase() throws IOException {
int[][] dataOne = {{1, 3}};
int[][] dataTwo = {{1, 4}};
FakeExtentIterator one = new FakeExtentIterator(dataOne);
FakeExtentIterator two = new FakeExtentIterator(dataTwo);
FakeExtentIterator[] iters = { one, two };
Parameters twoParam = new Parameters();
twoParam.add("width", "2");
UnorderedWindowIterator instance = new UnorderedWindowIterator(twoParam, iters);
ExtentArray array = instance.extents();
assertFalse(instance.isDone());
assertEquals(array.getPosition(), 1);
assertEquals(array.getBuffer()[0].document, 1);
assertEquals(array.getBuffer()[0].begin, 3);
assertEquals(array.getBuffer()[0].end, 5);
instance.nextDocument();
assertTrue(instance.isDone());
}
示例4: testUnordered
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public void testUnordered() throws IOException {
int[][] dataOne = {{1, 3}};
int[][] dataTwo = {{1, 4}};
FakeExtentIterator one = new FakeExtentIterator(dataOne);
FakeExtentIterator two = new FakeExtentIterator(dataTwo);
FakeExtentIterator[] iters = { one, two };
Parameters twoParam = new Parameters();
twoParam.add("width", "2");
UnorderedWindowIterator instance = new UnorderedWindowIterator(twoParam, iters);
ExtentArray array = instance.extents();
assertFalse(instance.isDone());
assertEquals(array.getPosition(), 1);
assertEquals(array.getBuffer()[0].document, 1);
assertEquals(array.getBuffer()[0].begin, 3);
assertEquals(array.getBuffer()[0].end, 5);
instance.nextDocument();
assertTrue(instance.isDone());
}
示例5: testTwoDocuments
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public void testTwoDocuments() throws IOException {
int[][] dataOne = {{1, 3}};
int[][] dataTwo = {{2, 4}};
FakeExtentIterator one = new FakeExtentIterator(dataOne);
FakeExtentIterator two = new FakeExtentIterator(dataTwo);
FakeExtentIterator[] iters = { one, two };
SynonymIterator instance = new SynonymIterator(new Parameters(), iters);
ExtentArray array = instance.extents();
assertFalse(instance.isDone());
assertEquals(1, array.getPosition());
assertEquals(1, array.getBuffer()[0].document);
assertEquals(3, array.getBuffer()[0].begin);
assertEquals(4, array.getBuffer()[0].end);
instance.nextDocument();
assertFalse(instance.isDone());
assertEquals(1, array.getPosition());
assertEquals(2, array.getBuffer()[0].document);
assertEquals(4, array.getBuffer()[0].begin);
assertEquals(5, array.getBuffer()[0].end);
instance.nextDocument();
assertTrue(instance.isDone());
}
示例6: testSameDocument
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public void testSameDocument() throws IOException {
int[][] dataOne = {{1, 3}};
int[][] dataTwo = {{1, 4}};
FakeExtentIterator one = new FakeExtentIterator(dataOne);
FakeExtentIterator two = new FakeExtentIterator(dataTwo);
FakeExtentIterator[] iters = { one, two };
SynonymIterator instance = new SynonymIterator(new Parameters(), iters);
ExtentArray array = instance.extents();
assertFalse(instance.isDone());
assertEquals(array.getPosition(), 2);
assertEquals(array.getBuffer()[0].document, 1);
assertEquals(array.getBuffer()[0].begin, 3);
assertEquals(array.getBuffer()[0].end, 4);
assertEquals(array.getBuffer()[1].document, 1);
assertEquals(array.getBuffer()[1].begin, 4);
assertEquals(array.getBuffer()[1].end, 5);
instance.nextDocument();
assertTrue(instance.isDone());
}
示例7: internalTestIterator
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public void internalTestIterator(
PositionIndexReader.Iterator termExtents,
int[][] data) throws IOException {
assertNotNull(termExtents);
assertFalse(termExtents.isDone());
for (int[] doc : data) {
assertFalse(termExtents.isDone());
ExtentArray e = termExtents.extents();
ExtentArrayIterator iter = new ExtentArrayIterator(e);
for (int i = 1; i < doc.length; i++) {
assertFalse(iter.isDone());
assertEquals(doc[i], iter.current().begin);
assertEquals(doc[i] + 1, iter.current().end);
iter.next();
}
assertTrue(iter.isDone());
termExtents.nextDocument();
}
assertTrue(termExtents.isDone());
}
示例8: ExtentDisjunctionIterator
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public ExtentDisjunctionIterator(ExtentIterator[] iterators) {
this.original = iterators;
this.iterators = new PriorityQueue<ExtentIterator>(iterators.length);
this.extents = new ExtentArray();
this.document = 0;
for (ExtentIterator iterator : original) {
if (!iterator.isDone()) {
this.iterators.add(iterator);
}
}
}
示例9: extents
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public ExtentArray extents() {
ExtentArray array = new ExtentArray();
int[] datum = data[index];
for( int i=1; i<datum.length; i++ ) {
array.add( datum[0], datum[i], datum[i]+1 );
}
return array;
}
示例10: testSingleExtent
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public void testSingleExtent() {
ExtentArray array = new ExtentArray();
array.add( 1, 5, 7 );
ExtentArrayIterator instance = new ExtentArrayIterator( array );
assertFalse( instance.isDone() );
assertEquals( instance.current().document, 1 );
assertEquals( instance.current().begin, 5 );
assertEquals( instance.current().end, 7 );
instance.next();
assertTrue( instance.isDone() );
}
示例11: testWrongOrder
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public void testWrongOrder() throws IOException {
int[][] dataOne = {{1, 3}};
int[][] dataTwo = {{1, 4}};
FakeExtentIterator one = new FakeExtentIterator(dataOne);
FakeExtentIterator two = new FakeExtentIterator(dataTwo);
FakeExtentIterator[] iters = { two, one };
Parameters oneParam = new Parameters();
oneParam.add("width", "1");
OrderedWindowIterator instance = new OrderedWindowIterator(oneParam, iters);
ExtentArray array = instance.extents();
assertEquals(0, array.getPosition());
}
示例12: testDifferentDocuments
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public void testDifferentDocuments() throws IOException {
int[][] dataOne = {{2, 3}};
int[][] dataTwo = {{1, 4}};
FakeExtentIterator one = new FakeExtentIterator(dataOne);
FakeExtentIterator two = new FakeExtentIterator(dataTwo);
FakeExtentIterator[] iters = { one, two };
Parameters twoParam = new Parameters();
twoParam.add("width", "2");
UnorderedWindowIterator instance = new UnorderedWindowIterator(twoParam, iters);
ExtentArray array = instance.extents();
assertEquals(0, array.getPosition());
assertTrue(instance.isDone());
}
示例13: testMultipleDocuments
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public void testMultipleDocuments() throws IOException {
int[][] dataOne = {{1, 3}, {2, 5}, {5, 11}};
int[][] dataTwo = {{1, 4}, {3, 8}, {5, 9}};
FakeExtentIterator one = new FakeExtentIterator(dataOne);
FakeExtentIterator two = new FakeExtentIterator(dataTwo);
FakeExtentIterator[] iters = { one, two };
Parameters fiveParam = new Parameters();
fiveParam.add("width", "5");
UnorderedWindowIterator instance = new UnorderedWindowIterator(fiveParam, iters);
ExtentArray array = instance.extents();
assertFalse(instance.isDone());
assertEquals(array.getPosition(), 1);
assertEquals(array.getBuffer()[0].document, 1);
assertEquals(array.getBuffer()[0].begin, 3);
assertEquals(array.getBuffer()[0].end, 5);
instance.nextDocument();
assertFalse(instance.isDone());
assertEquals(array.getPosition(), 1);
assertEquals(array.getBuffer()[0].document, 5);
assertEquals(array.getBuffer()[0].begin, 9);
assertEquals(array.getBuffer()[0].end, 12);
instance.nextDocument();
assertTrue(instance.isDone());
}
示例14: IntappScorer
import org.galagosearch.core.util.ExtentArray; //导入依赖的package包/类
public IntappScorer(Parameters parameters, CountIterator iterator) throws IOException {
super(iterator);
documentFrequency = 0;
documentCount = parameters.get("documentCount", 100000);
collectionLength = parameters.get("collectionLength", 1000000);
avgDocumentLength = collectionLength / documentCount;
if(iterator instanceof PositionIndexReader.Iterator) {
while(!iterator.isDone()) {
ArrayList<String> termList = new ArrayList<String>();
int document = iterator.document();
ExtentArray extentArray = ((PositionIndexReader.Iterator) iterator).extents();
ArrayList<Integer> termPositions = new ArrayList<Integer>();
for (int i = 0; i < extentArray.getPosition(); ++i) {
termPositions.add(extentArray.getBuffer()[i].begin);
}
termPositionsMap.put(document, termPositions);
byteLengthMap.put(document, ((PositionIndexReader.Iterator) iterator).getDocumentByteLength());
iterator.nextDocument();
}
}
iterator.reset();
while (!iterator.isDone()) {
documentFrequency += 1;
iterator.nextDocument();
}
iterator.reset();
computeInverseDocumentFrequency();
}