本文整理汇总了Java中org.galagosearch.tupleflow.Parameters.add方法的典型用法代码示例。如果您正苦于以下问题:Java Parameters.add方法的具体用法?Java Parameters.add怎么用?Java Parameters.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.galagosearch.tupleflow.Parameters
的用法示例。
在下文中一共展示了Parameters.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIterator
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
/**
* Given a query node, generates the corresponding iterator object that can be used
* for structured retrieval. This method just calls getClass() on the node,
* then instantiates the resulting class.
*
* If the class returned by getClass() is a ScoringFunction, it must contain
* a constructor that takes a single Parameters object. If the class returned by
* getFeatureClass() is some kind of StructuredIterator (either a ScoreIterator,
* ExtentIterator or CountIterator), it must take a Parameters object and an
* ArrayList of DocumentDataIterators as parameters.
*/
public StructuredIterator getIterator(Node node, ArrayList<StructuredIterator> childIterators) throws Exception {
NodeType type = getNodeType(node);
Constructor constructor = type.getConstructor();
Class[] types = type.getParameterTypes(1 + childIterators.size());
if (!isUsableConstructor(types, childIterators)) {
throw new Exception("Couldn't find a reasonable constructor.");
}
Parameters parametersCopy = new Parameters();
parametersCopy.copy(node.getParameters());
Object[] args = argsForConstructor(constructor.getParameterTypes(),
parametersCopy,
childIterators);
RequiredStatistics required =
type.getIteratorClass().getAnnotation(RequiredStatistics.class);
if (required != null) {
for (String statistic : required.statistics()) {
parametersCopy.add(statistic, parameters.get(statistic, null));
}
}
return (StructuredIterator) constructor.newInstance(args);
}
示例2: testUnordered
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的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());
}
示例3: getLinkCombineStage
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
public Stage getLinkCombineStage() {
Stage stage = new Stage("linkCombine");
stage.add(new StageConnectionPoint(ConnectionPointType.Input, "documentUrls",
new DocumentData.UrlOrder()));
stage.add(new StageConnectionPoint(ConnectionPointType.Input, "links",
new ExtractedLink.DestUrlOrder()));
stage.add(new StageConnectionPoint(ConnectionPointType.Output, "anchorText",
new AdditionalDocumentText.IdentifierOrder()));
Parameters p = new Parameters();
p.add("documentDatas", "documentUrls");
p.add("extractedLinks", "links");
stage.add(new Step(LinkCombiner.class, p));
stage.add(new Step(AnchorTextCreator.class));
stage.add(Utility.getSorter(new AdditionalDocumentText.IdentifierOrder()));
stage.add(new OutputStep("anchorText"));
return stage;
}
示例4: testGetFeatureClassName
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
/**
* Test of getFeatureClassName method, of class FeatureFactory.
*/
public void testGetFeatureClassName() throws Exception {
FeatureFactory f = new FeatureFactory(new Parameters());
Parameters p = new Parameters();
p.add("default", "dirichlet");
String actual = f.getFeatureClassName(p);
assertEquals(DirichletScorer.class.getName(), actual);
}
示例5: StructuredRetrieval
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
public StructuredRetrieval(StructuredIndex index, Parameters factoryParameters) {
this.index = index;
Parameters featureParameters = factoryParameters.clone();
featureParameters.add("collectionLength", Long.toString(index.getCollectionLength()));
featureParameters.add("documentCount", Long.toString(index.getDocumentCount()));
featureFactory = new FeatureFactory(featureParameters);
}
示例6: stemmedNode
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
private Node stemmedNode(Node original) {
Parameters parameters = original.getParameters().clone();
parameters.add("part", "stemmedPostings");
String term = parameters.get("default");
stemmer.setCurrent(term);
stemmer.stem();
String stemmed = stemmer.getCurrent();
parameters.set("default", stemmed);
return new Node("extents", parameters, original.getInternalNodes(), original.getPosition());
}
示例7: testSingleCompressedKeyValue
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
public void testSingleCompressedKeyValue() throws IOException {
Parameters parameters = new Parameters();
parameters.add("blockSize", Long.toString(64));
parameters.add("isCompressed", "true");
temporary = Utility.createTemporary();
IndexWriter writer = new IndexWriter(temporary.getAbsolutePath(), parameters);
writer.add(new GenericElement("key", "value"));
writer.close();
assertTrue(IndexReader.isIndexFile(temporary.getAbsolutePath()));
IndexReader reader = new IndexReader(temporary.getAbsolutePath());
assertEquals("value", reader.getValueString("key"));
reader.close();
}
示例8: getWritePostingsStage
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
public Stage getWritePostingsStage(String stageName, String inputName, String indexName) {
Stage stage = new Stage(stageName);
stage.add(new StageConnectionPoint(
ConnectionPointType.Input, inputName,
new NumberWordPosition.WordDocumentPositionOrder()));
stage.add(new InputStep(inputName));
Parameters p = new Parameters();
p.add("filename", indexPath + File.separator + "parts" + File.separator + indexName);
stage.add(new Step(PositionIndexWriter.class, p));
return stage;
}
示例9: getWriteExtentsStage
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
public Stage getWriteExtentsStage() {
Stage stage = new Stage("writeExtents");
stage.add(new StageConnectionPoint(
ConnectionPointType.Input, "numberedExtents",
new NumberedExtent.ExtentNameNumberBeginOrder()));
stage.add(new InputStep("numberedExtents"));
Parameters p = new Parameters();
p.add("filename", indexPath + File.separator + "parts" + File.separator + "extents");
stage.add(new Step(ExtentIndexWriter.class, p));
return stage;
}
示例10: getWriteDatesStage
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
public Stage getWriteDatesStage() {
Stage stage = new Stage("writeDates");
stage.add(new StageConnectionPoint(
ConnectionPointType.Input, "numberedDateExtents",
new NumberedValuedExtent.ExtentNameNumberBeginOrder()));
Parameters p = new Parameters();
p.add("filename", indexPath + File.separator + "parts" + File.separator + "dates");
stage.add(new Step(ExtentValueIndexWriter.class));
return stage;
}
示例11: getWriteManifestStage
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
/**
* Write out document count and collection length information.
*/
public Stage getWriteManifestStage() {
Stage stage = new Stage("writeManifest");
stage.add(new StageConnectionPoint(ConnectionPointType.Input,
"collectionLength",
new XMLFragment.NodePathOrder()));
stage.add(new InputStep("collectionLength"));
Parameters p = new Parameters();
p.add("filename", indexPath + File.separator + "manifest");
stage.add(new Step(ManifestWriter.class, p));
return stage;
}
示例12: getWriteDocumentLengthsStage
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
/**
* Writes document lengths to a document lengths file.
*/
public Stage getWriteDocumentLengthsStage() {
Stage stage = new Stage("writeDocumentLengths");
stage.add(new StageConnectionPoint(ConnectionPointType.Input,
"numberedDocumentData", new NumberedDocumentData.NumberOrder()));
Parameters p = new Parameters();
p.add("filename", indexPath + File.separator + "documentLengths");
stage.add(new InputStep("numberedDocumentData"));
stage.add(new Step(DocumentLengthsWriter.class, p));
return stage;
}
示例13: testMultipleDocuments
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的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: setUp
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
@Override
public void setUp() throws Exception {
// make a spot for the index
tempPath = File.createTempFile("galago-test-index", null);
tempPath.delete();
Parameters p = new Parameters();
p.add("filename", tempPath.toString());
ExtentIndexWriter writer =
new ExtentIndexWriter(new org.galagosearch.tupleflow.FakeParameters(p));
writer.processExtentName(Utility.makeBytes("title"));
writer.processNumber(1);
writer.processBegin(2);
writer.processTuple(3);
writer.processBegin(10);
writer.processTuple(11);
writer.processNumber(9);
writer.processBegin(5);
writer.processTuple(10);
writer.processExtentName(Utility.makeBytes("z"));
writer.processNumber(15);
writer.processBegin(9);
writer.processTuple(11);
writer.close();
}
示例15: testSeek
import org.galagosearch.tupleflow.Parameters; //导入方法依赖的package包/类
public void testSeek() throws IOException {
Parameters parameters = new Parameters();
parameters.add("blockSize", Long.toString(64));
temporary = Utility.createTemporary();
IndexWriter writer = new IndexWriter(temporary.getAbsolutePath(), parameters);
writer.add(new GenericElement("key", "value"));
writer.add(new GenericElement("more", "value2"));
writer.close();
assertTrue(IndexReader.isIndexFile(temporary.getAbsolutePath()));
IndexReader reader = new IndexReader(temporary.getAbsolutePath());
IndexReader.Iterator iterator = reader.getIterator();
// Skip to 'more'
iterator.skipTo(new byte[] { (byte) 'm' });
assertFalse(iterator.isDone());
assertEquals("more", iterator.getKey());
assertEquals("value2", iterator.getValueString());
assertFalse(iterator.nextKey());
// Start at the beginning
iterator = reader.getIterator();
assertFalse(iterator.isDone());
assertEquals("key", iterator.getKey());
assertTrue(iterator.nextKey());
assertEquals("more", iterator.getKey());
assertFalse(iterator.nextKey());
// Start after all keys
iterator = reader.getIterator();
assertFalse(iterator.isDone());
iterator.skipTo(new byte[] { (byte) 'z' });
assertTrue(iterator.isDone());
reader.close();
}