文を作成するために、マルコフ連鎖に基づいた python プロジェクトを作成しました。今、私は同じことをしなければなりませんが、処理中です。助けが必要なpythonコードは次のとおりdef createProbabilityHash(words)
です。
def createProbabilityHash(words):
numWords = len(words)
wordCount = {}
for word in words:
if wordCount.has_key(word):
wordCount[word] += 1
else:
wordCount[word] = 1