本文整理匯總了Java中org.galagosearch.tupleflow.FakeParameters類的典型用法代碼示例。如果您正苦於以下問題:Java FakeParameters類的具體用法?Java FakeParameters怎麽用?Java FakeParameters使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
FakeParameters類屬於org.galagosearch.tupleflow包,在下文中一共展示了FakeParameters類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buildIndex
import org.galagosearch.tupleflow.FakeParameters; //導入依賴的package包/類
public void buildIndex() throws FileNotFoundException, IOException {
File temporary = Utility.createTemporary();
// Build an encoded document:
document = new Document();
document.identifier = "doc-identifier";
document.text = "This is the text part.";
document.metadata.put("Key", "Value");
document.metadata.put("Something", "Else");
Parameters parameters = new Parameters();
parameters.add("filename", temporary.getAbsolutePath());
DocumentIndexWriter writer = new DocumentIndexWriter(new FakeParameters(parameters));
writer.process(document);
writer.close();
temporaryName = temporary.getAbsolutePath();
assertTrue(IndexReader.isIndexFile(temporaryName));
}
示例2: testCountUnigrams
import org.galagosearch.tupleflow.FakeParameters; //導入依賴的package包/類
public void testCountUnigrams() throws IOException, IncompatibleProcessorException {
Parameters p = new Parameters();
p.add("width", "1");
WordCounter counter = new WordCounter(new FakeParameters(p));
Document document = new Document();
PostStep post = new PostStep();
counter.setProcessor(post);
document.terms = new ArrayList<String>();
document.terms.add("one");
document.terms.add("two");
document.terms.add("one");
counter.process(document);
assertEquals(2, post.results.size());
for (int i = 0; i < post.results.size(); ++i) {
WordCount wc = post.results.get(i);
if (wc.word.equals("one")) {
assertEquals(2, wc.count);
} else {
assertEquals(1, wc.count);
}
}
}
示例3: setUp
import org.galagosearch.tupleflow.FakeParameters; //導入依賴的package包/類
@Override
public void setUp() throws IOException {
// make a spot for the index
tempPath = File.createTempFile("galago-test-index", null);
tempPath.delete();
Parameters p = new Parameters();
p.add("filename", tempPath.toString());
TupleFlowParameters parameters = new FakeParameters(p);
SparseFloatListWriter writer = new SparseFloatListWriter(parameters);
writer.processWord(Utility.makeBytes("a"));
for (int i = 0; i < aDocs.length; i++) {
writer.processNumber(aDocs[i]);
writer.processTuple(aScores[i]);
}
writer.processWord(Utility.makeBytes("b"));
for (int i = 0; i < bDocs.length; i++) {
writer.processNumber(bDocs[i]);
writer.processTuple(bScores[i]);
}
writer.close();
}
示例4: testUnknownFile
import org.galagosearch.tupleflow.FakeParameters; //導入依賴的package包/類
public void testUnknownFile() throws Exception {
Parameters p = new Parameters();
p.add("filename", "foo.c");
DocumentSource source = new DocumentSource(new FakeParameters(p));
FakeProcessor processor = new FakeProcessor();
source.setProcessor(processor);
boolean threwException = false;
try {
source.run();
} catch(Exception e) {
threwException = true;
}
assertTrue(threwException);
}
示例5: testUnknownExtension
import org.galagosearch.tupleflow.FakeParameters; //導入依賴的package包/類
public void testUnknownExtension() throws Exception {
File tempFile = Utility.createTemporary();
Parameters p = new Parameters();
p.add("filename", tempFile.getAbsolutePath());
DocumentSource source = new DocumentSource(new FakeParameters(p));
FakeProcessor processor = new FakeProcessor();
source.setProcessor(processor);
source.run();
assertEquals(0, processor.splits.size());
tempFile.delete();
}
示例6: createFakeParameters
import org.galagosearch.tupleflow.FakeParameters; //導入依賴的package包/類
public static TupleFlowParameters createFakeParameters(File tempPath) {
Parameters p = new Parameters();
p.add("filename", tempPath.toString());
return new FakeParameters(p);
}