---------- Forwarded message ---------- From: V R <v.shinings...@gmail.com> Date: Wed, Aug 10, 2011 at 6:51 PM Subject: please help me To: java-user-i...@lucene.apache.org
Dear all I'm a beginner and I need to calculate Precision and recall. I do it by Lucene and java. I found code for caculating Precision and Recall in lucene, but unfortunatly when I run this, program dosent know some import classes, I think I should add something to program which is in sourcefile packege which I download from http://www.manning.com/hatcher3/ (the source code size is 61MB) I think it should be a java library package. I sent program running and some of unknown classes are shown in picture. (problem in attached file) and program code (code in attached files). I thought I shoud do s.th like (rightclick on src and add external libraray! )but the file I downloaded (source code) is consist of alot of sub folders and.. so I confused!! can you have a look to them, I'm sure you know how can I deal with them,
package lia.benchmark; import java.io.File; import java.io.PrintWriter; import java.io.BufferedReader; import java.io.FileReader; import org.apache.lucene.index.*; import org.apache.lucene.search.*; import org.apache.lucene.store.*; import org.apache.lucene.benchmark.quality.*; import org.apache.lucene.benchmark.quality.utils.*; import org.apache.lucene.benchmark.quality.trec.*; // From appendix C /* This code was extracted from the Lucene contrib/benchmark sources */ public class PrecisionRecall { public static void main(String[] args) throws Throwable { File topicsFile = new File("C:/lia2e/src/lia/benchmark/topics.txt"); File qrelsFile = new File("C:/lia2e/src/lia/benchmark/qrels.txt"); Directory dir = FSDirectory.open(new File("C:/myindex")); Searcher searcher = new IndexSearcher(dir, true); String docNameField = "filename"; PrintWriter logger = new PrintWriter(System.out, true); TrecTopicsReader qReader = new TrecTopicsReader(); //#1 QualityQuery qqs[] = qReader.readQueries( //#1 new BufferedReader(new FileReader(topicsFile))); //#1 Judge judge = new TrecJudge(new BufferedReader( //#2 new FileReader(qrelsFile))); //#2 judge.validateData(qqs, logger); //#3 QualityQueryParser qqParser = new SimpleQQParser("title", "contents"); //#4 QualityBenchmark qrun = new QualityBenchmark(qqs, qqParser, searcher, docNameField); SubmissionReport submitLog = null; QualityStats stats[] = qrun.execute(judge, //#5 submitLog, logger); QualityStats avg = QualityStats.average(stats); //#6 avg.log("SUMMARY",2,logger, " "); dir.close(); } } /* 69 #1 Read TREC topics as QualityQuery[] 70 #2 Create Judge from TREC Qrel file 71 #3 Verify query and Judge match 72 #4 Create parser to translate queries into Lucene queries 73 #5 Run benchmark 74 #6 Print precision and recall measures 75 */
--------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org