0

I am facing problem in performing Morkov model

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()

I get the following error report

 An exception has occurred, use %tb to see the full traceback.

SystemExit: Usage: python generator.py sample.txt

please solve my problem

user103987
  • 65
  • 2
  • 9

1 Answers1

0

Execute your code in command line with this command.

python generator.py sample.txt

Here generator.py python file in the code and sample.txt file is dataset file

Waseem Randhawa
  • 149
  • 2
  • 17