def printNBest(self, cell_type, sent_indx):

        nbest_cnt = 0
        #uniq_tgtDict = {}
        oF = open(settings.opts.outFile, 'a')

        tgt_key = self.calcCandScore(cell_type)
        entriesLst = []
        if settings.opts.nbest_extremum == 0:
            nbest_2_produce = settings.opts.nbest_limit
            entriesLst = self.table[tgt_key][:]
        else:
            nbest_2_produce = 2 * settings.opts.nbest_extremum
            # Get nbest_extreumum best and worst entries from the nbest-list
            #if len( self.table[tgt_key][:] ) >= settings.opts.nbest_limit:
            #    entriesLst = self.table[tgt_key][0:settings.opts.nbest_extremum] + \
            #                    self.table[tgt_key][settings.opts.nbest_limit-settings.opts.nbest_extremum:settings.opts.nbest_limit]
            #elif len( self.table[tgt_key][:] ) >= nbest_2_produce:
            if len( self.table[tgt_key][:] ) >= nbest_2_produce:
                entriesLst = self.table[tgt_key][0:settings.opts.nbest_extremum] + self.table[tgt_key][-settings.opts.nbest_extremum:]
            else: entriesLst = self.table[tgt_key][:]

        for entry in entriesLst:
            if not settings.opts.nbest_format:
                oF.write( "%s\n" % entry.getHypothesis() )
            else:
                (cand, feat_str) = entry.printEntry()
                oF.write( "%d||| %s ||| %s ||| %g\n" % ( sent_indx, cand, feat_str, entry.score ) )
                #if not settings.opts.use_unique_nbest:
                #    oF.write( "%d||| %s ||| %s ||| %g\n" % ( sent_indx, cand, feat_str, entry.score ) )
                #elif settings.opts.use_unique_nbest and not uniq_tgtDict.has_key(cand):
                #    uniq_tgtDict[cand] = 1
                #    oF.write( "%d||| %s ||| %s ||| %g\n" % ( sent_indx, cand, feat_str, entry.score ) )

            nbest_cnt += 1
            if nbest_cnt == nbest_2_produce: break  # stop after producing required no of items
        oF.close()
Print the N-best list for the goal symbol
dataset/ETHPy150Open sfu-natlang/Kriya/src/Kriya-Decoder/cell.py/Cell.printNBest