try:
    with codecs.open(trainfile, 'r', 'utf8') as fin:
        punkt.train(fin.read(), finalize=False, verbose=False)
except KeyboardInterrupt:
    print('KeyboardInterrupt: Stopping the reading of the dump early!')
abbrv_sent = ' '.join([i.strip() for i in codecs.open('abbrev.lex', 'r',
    'utf8').readlines()])
abbrv_sent = 'Start' + abbrv_sent + 'End.'
punkt.train(abbrv_sent, finalize=False, verbose=False)
punkt.finalize_training(verbose=True)
model = PunktSentenceTokenizer(punkt.get_params())
with open(modelfile, mode='wb') as fout:
    pickle.dump(model, fout, protocol=pickle.HIGHEST_PROTOCOL)
return model
training data format for nltk punkt