You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I condition the text generation given a previous input.
Example: After creating the model, I pass a 'seed' (a small string) so that the generated sentence is a response based on the text considering a 'seed' given by the user.
I tried to use the 'make_sentence' function passing a string and a list of strings but I got the error below
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/studyvenv/lib/python3.10/site-packages/markovify/text.py", line 231, in make_sentence
words = prefix + self.chain.walk(init_state)
File "/home/user/studyvenv/lib/python3.10/site-packages/markovify/chain.py", line 142, in walk
return list(self.gen(init_state))
File "/home/user/studyvenv/lib/python3.10/site-packages/markovify/chain.py", line 130, in gen
next_word = self.move(state)
File "/home/user/studyvenv/lib/python3.10/site-packages/markovify/chain.py", line 116, in move
choices, weights = zip(*self.model[state].items())
KeyError: ('Hi.', 'How are you')
The text was updated successfully, but these errors were encountered:
Hi @wsricardo, and thanks for your interest in this library. Without access to the code or text corpus you're using, it's a bit hard to diagnose your issue definitively. But the issue appears to be that the prompt (('Hi.', 'How are you')) cannot be found in the corpus because it spans two sentences, while the default model first decomposes each corpus into single sentences. Is that helpful guidance? If not, could you provide more information and examples?
I search 'function' in module to return response based user input to prompt. I don't remember that exactly a I use this function. Thank you very much to answer.
How can I condition the text generation given a previous input.
Example: After creating the model, I pass a 'seed' (a small string) so that the generated sentence is a response based on the text considering a 'seed' given by the user.
I tried to use the 'make_sentence' function passing a string and a list of strings but I got the error below
The text was updated successfully, but these errors were encountered: