可以区分日期、分数、百分数、十进制计数法、常用缩写
但是还有诸多问题,同样地,结课后如有机会我会完善
—— 2017.10.27
# -*- coding: utf-8 -*-
__author__ = 'Zhao'
import re
str = input("please input a pharagraph:\n")
# trans SPECIAL CHARACTER
str = re.sub(r'Prof\.|prof\.', 'professor', str)
str = re.sub(r'ies\W|ies$', 'i ', str)
str = re.sub(r'i\'m|I\'m', 'I am ', str)
str = re.sub(r'it\'s|It\'s', 'It is ', str)
str = re.sub(r'can\'t|Can\'t', 'can not', str)
str = re.sub(r'doesn\'t|Doesn\'t', 'does not', str)
str = re.sub(r'\'re', " are", str)
str = re.sub(r'i\W|i$', 'y ', str)
str = re.sub(r's\W|s$', ' ', str)
str = re.sub(r'let\'|Let\'', 'let us', str)
str = re.sub(r'\Wy\W|\W