第8章 疯狂填词

#疯狂填词
import re
text = 'The ADJECTIVE panda walked to the NOUN and then VERB. A nearby NOUN was unaffected by these events.'
repTargetList = re.compile(r'[A-Z]{2,}').findall(text)
print(repTargetList)
for Target in repTargetList:
       repTarget = input('请输入%s: \n' % Target).lower()
       text = text.replace(Target, repTarget, 1)
print(text)

猜你喜欢

转载自blog.csdn.net/baidu_27361307/article/details/80817361