【发布时间】:2020-06-28 09:30:22
【问题描述】:
我在执行 Morkov 模型时遇到问题
import markovify
import sys
# Read text from file
if len(sys.argv) != 2:
sys.exit("Usage: python generator.py sample.txt")
with open(sys.argv[1]) as f:
text = f.read()
# Train model
text_model = markovify.Text(text)
# Generate sentences
print()
for i in range(5):
print(text_model.make_sentence())
print()
我收到以下错误报告
An exception has occurred, use %tb to see the full traceback.
SystemExit: Usage: python generator.py sample.txt
请解决我的问题
【问题讨论】:
标签: python-2.7 markov