def process_nbest(fread, fwrite):
    nEmptySentNum = 0
    with open(fread, 'rt') as f1, open(fwrite, 'wt') as f2:
        for a in [line.split() for line in f1]:
            if len(a) == 1:
                nEmptySentNum += 1
                a.append('<UNK>')
            f2.write(' '.join(a) + '\n')
    print('[nbest] empty sentence num = {}'.format(nEmptySentNum))