本文整理汇总了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;
}