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


Java TrecTopicsReader类代码示例

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


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

示例1: testTrecTopicsReader

import org.apache.lucene.benchmark.quality.trec.TrecTopicsReader; //导入依赖的package包/类
public void testTrecTopicsReader() throws Exception {    
  // prepare topics
  InputStream topicsFile = getClass().getResourceAsStream("trecTopics.txt");
  TrecTopicsReader qReader = new TrecTopicsReader();
  QualityQuery qqs[] = qReader.readQueries(
      new BufferedReader(new InputStreamReader(topicsFile, StandardCharsets.UTF_8)));
  
  assertEquals(20, qqs.length);
  
  QualityQuery qq = qqs[0];
  assertEquals("statement months  total 1987", qq.getValue("title"));
  assertEquals("Topic 0 Description Line 1 Topic 0 Description Line 2", 
      qq.getValue("description"));
  assertEquals("Topic 0 Narrative Line 1 Topic 0 Narrative Line 2", 
      qq.getValue("narrative"));
  
  qq = qqs[1];
  assertEquals("agreed 15  against five", qq.getValue("title"));
  assertEquals("Topic 1 Description Line 1 Topic 1 Description Line 2", 
      qq.getValue("description"));
  assertEquals("Topic 1 Narrative Line 1 Topic 1 Narrative Line 2", 
      qq.getValue("narrative"));
  
  qq = qqs[19];
  assertEquals("20 while  common week", qq.getValue("title"));
  assertEquals("Topic 19 Description Line 1 Topic 19 Description Line 2", 
      qq.getValue("description"));
  assertEquals("Topic 19 Narrative Line 1 Topic 19 Narrative Line 2", 
      qq.getValue("narrative"));
}
 
开发者ID:europeana,项目名称:search,代码行数:31,代码来源:TestQualityRun.java

示例2: testTrecTopicsReader

import org.apache.lucene.benchmark.quality.trec.TrecTopicsReader; //导入依赖的package包/类
public void testTrecTopicsReader() throws Exception {    
  // prepare topics
  InputStream topicsFile = getClass().getResourceAsStream("trecTopics.txt");
  TrecTopicsReader qReader = new TrecTopicsReader();
  QualityQuery qqs[] = qReader.readQueries(
      new BufferedReader(new InputStreamReader(topicsFile, "UTF-8")));
  
  assertEquals(20, qqs.length);
  
  QualityQuery qq = qqs[0];
  assertEquals("statement months  total 1987", qq.getValue("title"));
  assertEquals("Topic 0 Description Line 1 Topic 0 Description Line 2", 
      qq.getValue("description"));
  assertEquals("Topic 0 Narrative Line 1 Topic 0 Narrative Line 2", 
      qq.getValue("narrative"));
  
  qq = qqs[1];
  assertEquals("agreed 15  against five", qq.getValue("title"));
  assertEquals("Topic 1 Description Line 1 Topic 1 Description Line 2", 
      qq.getValue("description"));
  assertEquals("Topic 1 Narrative Line 1 Topic 1 Narrative Line 2", 
      qq.getValue("narrative"));
  
  qq = qqs[19];
  assertEquals("20 while  common week", qq.getValue("title"));
  assertEquals("Topic 19 Description Line 1 Topic 19 Description Line 2", 
      qq.getValue("description"));
  assertEquals("Topic 19 Narrative Line 1 Topic 19 Narrative Line 2", 
      qq.getValue("narrative"));
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:31,代码来源:TestQualityRun.java

示例3: main

import org.apache.lucene.benchmark.quality.trec.TrecTopicsReader; //导入依赖的package包/类
public static void main(String[] args) throws Throwable {

        File topicsFile = new File("aos/lucene/benchmark/topics.txt");
        File qrelsFile = new File("aos/lucene/benchmark/qrels.txt");
        Directory dir = FSDirectory.open(new File("indexes/MeetLucene"));
        IndexReader reader = DirectoryReader.open(dir);
        IndexSearcher searcher = new IndexSearcher(reader);

        String docNameField = "filename";

        PrintWriter LOGGER = new PrintWriter(System.out, true);

        TrecTopicsReader qReader = new TrecTopicsReader();
        QualityQuery qqs[] = qReader.readQueries(new BufferedReader(new FileReader(topicsFile)));

        Judge judge = new TrecJudge(new BufferedReader(new FileReader(qrelsFile)));

        judge.validateData(qqs, LOGGER);

        QualityQueryParser qqParser = new SimpleQQParser("title", "contents");

        QualityBenchmark qrun = new QualityBenchmark(qqs, qqParser, searcher, docNameField);
        SubmissionReport submitLog = null;
        QualityStats stats[] = qrun.execute(judge, submitLog, LOGGER);

        QualityStats avg = QualityStats.average(stats);
        avg.log("SUMMARY", 2, LOGGER, "  ");

        dir.close();

    }
 
开发者ID:xuzhikethinker,项目名称:t4f-data,代码行数:32,代码来源:PrecisionRecall.java


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