Package joshua.decoder

Examples of joshua.decoder.NbestMinRiskReranker


 
    int ngramStateID = 0;
    SymbolTable symbolTbl = new BuildinSymbol(null);;
   
    NbestCrunching cruncher = new NbestCrunching(symbolTbl, scalingFactor, topN);
    NbestMinRiskReranker mbrReranker = new NbestMinRiskReranker(false, 1.0);
 
    BufferedWriter onebestWriter =  FileUtilityOld.getWriteFileStream(onebestFile)
   
    System.out.println("############Process file  " + testItemsFile);
    DiskHyperGraph diskHG = new DiskHyperGraph(symbolTbl, ngramStateID, true, null); //have model costs stored
    diskHG.initRead(testItemsFile, testRulesFile,null);     
    for(int sentID=0; sentID < numSents; sentID ++){
      System.out.println("#Process sentence " + sentID);
      HyperGraph testHG = diskHG.readHyperGraph();
     
      List<String> nbest = cruncher.processOneSent(testHG, sentID, true);//produce the disorder nbest
     
      String bestHyp = mbrReranker.processOneSent(nbest, sentID);//nbest: list of unique strings
     
      FileUtilityOld.writeLzf(onebestWriter, bestHyp + "\n");
    }
    FileUtilityOld.closeWriteFile(onebestWriter);       
  }
View Full Code Here

TOP

Related Classes of joshua.decoder.NbestMinRiskReranker

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.