-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make_sentence_with_start() returns error if only one word is used #34
Comments
What version of |
Yep, that was the issue 🤦 |
It's now returning ('_BEGIN', 'word') , but I guess that's an issue with not having enough sample to use. Do you have any tips on managing memory usage? cpu usage spikes up and down 90% when this is used, and memory usage doubles and stays high. This is with a 2mb txt file |
Hmmm, haven't noticed memory problems like that lately, but it's possible I've overlooked an edge case. Have you tried profiling your program? If you send over the script and corpus, I can also try taking a look. |
async def bloc_speaks(prompt=""):
try:
with open(os.getcwd() + '/BlocSim/BlocSpeaks.txt',
'r', encoding='utf-8') as f:
text = f.read()
except FileNotFoundError:
print("File not found")
return
text_model = markovify.Text(text)
try:
if prompt:
sentence = text_model.make_sentence_with_start(prompt)
return sentence
else:
sentence = text_model.make_sentence()
return sentence
except Exception as e:
return (e) |
It used to just use memory and do nothing, but now it gives:
This is in Python 3.5.2
Code:
The text was updated successfully, but these errors were encountered: