# -*- coding: utf-8 -*-
import re

inputfile = 'nlp.txt'
pattern = '[.;:?!]\s[A-Z]'

def sentense_split(str):
    match = re.findall(pattern, str)
    if not match:
        return str
    for m in match:
        mr = re.sub('\s', '\n', m)
        str = re.sub(m, mr, str)
    return str

def main(file):
    with open(file, 'r') as f:
        for fr in f.readlines():
            if '\n' == fr:
                continue
            fr = sentense_split(fr)
            print fr

if __name__ == '__main__':
    main(inputfile)
