Closed ineptvirus closed 6 years ago
The error comes from markovify due to an empty corpus, same as the issues you found. The root cause in this case however is from DerpyBot. When given an empty input file (or no file at all) it would blindly send the empty string to markovify, which doesn't like that. In past testing and use it never got used without an existing input file so this case was overlooked.
I added a fix that should address the problem and put up a new release. Let me know how it works. https://github.com/OtakuMegane/DerpyBot/releases/tag/v0.9.3.4
Yes, this resolves the issue! Thanks for quick response. I have another issue but I will open a new issue case.
ty
Hi, I'm a bit of a noob at this stuff but I'm stuck on an error with your program. When running 'derpybot.py' using IDLE and F5 I get the following text:
========= RESTART: C:\Users\Jake\Mirai\DerpyBot-v0.9.3.2\derpybot.py ========= [DerpyBot] DerpyBot version 0.9.3.2 [DerpyBot] Loading markov... [DerpyMarkov] Loading DerpyMarkov... [DerpyMarkov] DerpyMarkov version 0.9.3.2 Traceback (most recent call last): File "C:\Users\Jake\Mirai\DerpyBot-v0.9.3.2\derpybot.py", line 130, in
markov_load(False)
File "C:\Users\Jake\Mirai\DerpyBot-v0.9.3.2\derpybot.py", line 109, in markov_load
markov.activate(reload)
File "C:\Users\Jake\Mirai\DerpyBot-v0.9.3.2\modules\derpymarkov\markov.py", line 58, in activate
model = derpymodel.DerpyText(input_text, state_size = config.state_size1)
File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\markovify\text.py", line 37, in init
self.chain = chain or Chain(self.parsed_sentences, state_size)
File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\markovify\chain.py", line 45, in init
self.precompute_begin_state()
File "C:\Users\Jake\AppData\Local\Programs\Python\Python36-32\lib\site-packages\markovify\chain.py", line 80, in precompute_begin_state
choices, weights = zip(*self.model[begin_state].items())
KeyError: ('_BEGIN',)
From googling the issue it seems to be a Markovify issue, but I have not been able to find a fix yet as there is only two threads on the issue which is a little bit different to mine