forked from gooberinc/goober
cleaned up bot.py seperating it into different files, added formatting ignore rules for key_compiler, modified prestart checks
This commit is contained in:
parent
f186e079da
commit
92dbc06b26
9 changed files with 311 additions and 264 deletions
|
@ -45,16 +45,19 @@ def save_memory(memory):
|
|||
json.dump(memory, f, indent=4)
|
||||
|
||||
|
||||
def train_markov_model(memory, additional_data=None):
|
||||
def train_markov_model(memory, additional_data=None) -> markovify.NewlineText | None:
|
||||
if not memory:
|
||||
return None
|
||||
|
||||
filtered_memory = [line for line in memory if isinstance(line, str)]
|
||||
if additional_data:
|
||||
filtered_memory.extend(
|
||||
line for line in additional_data if isinstance(line, str)
|
||||
)
|
||||
|
||||
if not filtered_memory:
|
||||
return None
|
||||
|
||||
text = "\n".join(filtered_memory)
|
||||
model = markovify.NewlineText(text, state_size=2)
|
||||
return model
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue