当前位置: 首页>>代码示例>>Java>>正文


Java LuceneIndexFromTriples类代码示例

本文整理汇总了Java中pitt.search.lucene.LuceneIndexFromTriples的典型用法代码示例。如果您正苦于以下问题:Java LuceneIndexFromTriples类的具体用法?Java LuceneIndexFromTriples怎么用?Java LuceneIndexFromTriples使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LuceneIndexFromTriples类属于pitt.search.lucene包,在下文中一共展示了LuceneIndexFromTriples类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareTestData

import pitt.search.lucene.LuceneIndexFromTriples; //导入依赖的package包/类
public static void prepareTestData() throws IOException {
  if (testDataPrepared) return;
      
  // Create basic vector store files. No Lucene / corpus dependencies here.
  BufferedWriter outBuf = new BufferedWriter(new FileWriter("testtermvectors.txt"));
  outBuf.write(testVectors);
  outBuf.close();

  String[] translaterArgs = {"-TEXTTOLUCENE", "testtermvectors.txt", "tmp/testtermvectors.bin"};
  VectorStoreTranslater.main(translaterArgs);

  // Create Lucene indexes from test corpus, to use in index building and searching tests.
  String testDataPath = "src/test/resources/testdata/";
  String johnTestDataPath = testDataPath + "John";
  File johnTestDataDir = new File(johnTestDataPath);
  if (!johnTestDataDir.isDirectory()) {
    throw new IOException("No directory for test data at: " + johnTestDataDir.getAbsolutePath());
  }
  
  if (Arrays.asList(new File(".").list()).contains("positional_index")) {
    VerbatimLogger.warning(new File(".").getCanonicalPath() + " already contains positional_index. "
        + "Please delete if you want to run from clean.\n");
  } else {
    IndexFilePositions.main(new String[] {"-luceneindexpath", "positional_index", johnTestDataPath});
  }
  
  String triplesTestDataPath = "src/test/resources/testdata/nationalfacts/nationalfacts.txt";
  if (Arrays.asList(new File(".").list()).contains("predication_index")) {
    VerbatimLogger.warning(new File(".").getCanonicalPath() + " already contains predication_index. "
        + "Please delete if you want to run from clean.\n");
  } else {
    LuceneIndexFromTriples.main(new String[] {triplesTestDataPath});
  }
    
  testDataPrepared = true;
}
 
开发者ID:semanticvectors,项目名称:semanticvectors,代码行数:37,代码来源:RunTests.java


注:本文中的pitt.search.lucene.LuceneIndexFromTriples类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。