public void lazyKBestExtractOnHG(HyperGraph hg,int topN,BufferedWriter out) throws IOException {
  resetState();
  if (null == hg.goalNode)   return;
  for (int k=1; k <= topN; k++) {
    String hypStr=getKthHyp(hg.goalNode,k);
    if (null == hypStr)     break;
    out.write(hypStr);
    out.write("\n");
    out.flush();
  }
}

public void lazyKBestExtractOnHG ( HyperGraph hg , int topN , BufferedWriter out ) throws IOException { resetState ( ) ; if ( null == hg . goalNode ) return ; for ( int k = 1 ; k <= topN ; k ++ ) { String hypStr = getKthHyp ( hg . goalNode , k ) ; if ( null == hypStr ) break ; out . write ( hypStr ) ; out . write ( "\n" ) ; out . flush ( ) ; } }
this is the entry point for extracting k - best hypotheses . it computes all of them , writing the results to the bufferedwriter passed in . if you want intermediate access to the k - best derivations , you ' ll want to call getkthhyp ( ) or getkthderivation ( ) directly . the number of derivations that are looked for is controlled by the ` top - n ` parameter . note that when ` top - n ` is set to 0 , k - best extraction is disabled entirely , and only things like the viterbi string and the model score are available to the decoder . since k - best extraction involves the recomputation of features to get the component values , turning off that extraction saves a lot of time when only the 1 - best string is desired .
