當前位置: 首頁>>代碼示例>>Java>>正文


Java FakeParameters類代碼示例

本文整理匯總了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));
}
 
開發者ID:jjfiv,項目名稱:galagosearch,代碼行數:20,代碼來源:IndexReaderSplitParserTest.java

示例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);
        }
    }
}
 
開發者ID:youngilcho,項目名稱:internet-application-2014,代碼行數:27,代碼來源:WordCounterTest.java

示例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();
}
 
開發者ID:jjfiv,項目名稱:galagosearch,代碼行數:29,代碼來源:SparseFloatListReaderTest.java

示例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);
}
 
開發者ID:youngilcho,項目名稱:internet-application-2014,代碼行數:16,代碼來源:DocumentSourceTest.java

示例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();
}
 
開發者ID:youngilcho,項目名稱:internet-application-2014,代碼行數:13,代碼來源:DocumentSourceTest.java

示例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);
}
 
開發者ID:jjfiv,項目名稱:galagosearch,代碼行數:7,代碼來源:RetrievalTestUtility.java


注:本文中的org.galagosearch.tupleflow.FakeParameters類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。