question: 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 ( ) ; } }
target:  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.