Package ivory.core.util

Examples of ivory.core.util.ResultWriter


      sLogger.info("query id:" + qid + ", query text:" + rawQueryText);
      runner.runQuery(qid, rawQueryText.split("\\s+"));
    }

    // where should we output these results?
    ResultWriter resultWriter = null;
    resultWriter = getResultWriter(mOutputFile, false);

    printResults(mRuntag, runner, resultWriter);
    // flush the result writer
    resultWriter.flush();
  }
View Full Code Here


    // flush the result writer
    resultWriter.flush();
  }

  public ResultWriter getResultWriter(String fileName, boolean compress) throws Exception {
    return new ResultWriter(fileName, compress, mFileSystem);
  }
View Full Code Here


      String internalOutputFile = internalOutputFiles[modelCnt];

      try {
        ResultWriter resultWriter = new ResultWriter(fileName, compress, fs);

        //print out representation that uses internal docno for next cascade stage if doing boosting training
        if (internalOutputFile!=null){

          ResultWriter resultWriter2 = new ResultWriter(internalOutputFile, compress, fs);
          printResults(modelID, runner, resultWriter2, true);
          resultWriter2.flush();
        }

        printResults(modelID, runner, resultWriter, false);
        resultWriter.flush();
      } catch (IOException e) {
View Full Code Here

    runName = Utils.getSetting(conf);
   
    try {
      LOG.info("Parsed "+queries.size()+" queries");

      ResultWriter resultWriter = new ResultWriter("ranking." + runName + ".txt", false, fs);
      float rankTime = 0, generateTime = 0;
      for ( String qid : queries.keySet()) {
        String query = queries.get(qid);

        long start = System.currentTimeMillis();
        JSONObject structuredQuery = generator.parseQuery(query);
        long end = System.currentTimeMillis();
        LOG.info("Generating " + qid + ": " + ( end - start) + "ms");
        generateTime += ( end - start ) ;
        LOG.info("<Processed>:::" + runName + ":::" + qid + ":::" + structuredQuery);

        start = System.currentTimeMillis();
        ranker.rank(qid, structuredQuery, generator.getQueryLength());
        end = System.currentTimeMillis();
        LOG.info("Ranking " + qid + ": " + ( end - start) + "ms");
        rankTime += ( end - start ) ;
        printResults(qid, runName, ranker, resultWriter);
       
        // save allResults
        allResults.put(runName, getResults());
      }  
      resultWriter.flush();
      LOG.info("<TIME>:::" + runName + ":::" + generateTime + ":::" + rankTime);
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

     
      String outFile = conf.get(Constants.OutputPath);

      String translateOnly = conf.get(Constants.TranslateOnly);
      if (translateOnly != null) {
        ResultWriter resultWriter = new ResultWriter((outFile == null ? "translations." + runName + ".txt" : outFile), false, fs);
        for (String qid : queries.keySet()) {
          String query = queries.get(qid);
       
          if (grammarPaths != null) {
            String grammarPath = grammarPaths.get(qid);
            conf.set(Constants.GrammarPath, grammarPath);
          }
       
          long start = System.currentTimeMillis();
          StructuredQuery structuredQuery = generator.parseQuery(query, fs, conf);
          long end = System.currentTimeMillis();
          System.out.println("Generating " + qid + ": " + ( end - start) + "ms");
          generateTime += ( end - start ) ;
          System.out.println("<Processed>:::" + runName + ":::" + qid + ":::" + structuredQuery.getQuery());
          printResults(qid, runName, structuredQuery, resultWriter, translateOnly.equals(Constants.Indri));
        }
        resultWriter.flush();
        System.out.println("<TIME>:::" + runName + ":::" + generateTime + ":::" + rankTime);
      } else {
        ResultWriter resultWriter = new ResultWriter((outFile == null ? "ranking." + runName + ".txt" : outFile), false, fs);
        for ( String qid : queries.keySet()) {
          String query = queries.get(qid);

          if (grammarPaths != null) {
            String grammarPath = grammarPaths.get(qid);
            conf.set(Constants.GrammarPath, grammarPath);
          }
         
          long start = System.currentTimeMillis();
          StructuredQuery structuredQuery = generator.parseQuery(query, fs, conf);
          long end = System.currentTimeMillis();
          System.out.println("Generating " + qid + ": " + ( end - start) + "ms");
          generateTime += ( end - start ) ;
          System.out.println("<Processed>:::" + runName + ":::" + qid + ":::" + structuredQuery.getQuery());
         
          start = System.currentTimeMillis();
          ranker.rank(qid, structuredQuery.getQuery(), structuredQuery.getQueryLength());
          end = System.currentTimeMillis();
          System.out.println("Ranking " + qid + ": " + ( end - start) + "ms");
          rankTime += ( end - start ) ;
          printResults(qid, runName, ranker, resultWriter);
         
          // save allResults
          allResults.put(runName, getResults());
        }  
        resultWriter.flush();
        System.out.println("<TIME>:::" + runName + ":::" + generateTime + ":::" + rankTime);
      }
    } catch (IOException e) {
      e.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of ivory.core.util.ResultWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.