-2
我正在嘗試將文本中名詞中的單詞改爲「名詞」。 我有麻煩。這是我到目前爲止。Python中的文件更改
def noun(file):
for word in file:
for ch in word:
if ch[-1:-3] == "ion" or ch[-1:-3] == "ism" or ch[-1:-3] == "ity":
word = "noun"
if file(word-1) == "the" and (file(word+1)=="of" or file(word+1) == "on"
word = "noun"
# words that appear after the
return outfile
任何想法?
「我有麻煩」是不是很描述你的問題。究竟是什麼問題? – iCodez 2014-11-20 18:01:20