lobotmized goober and cleared out junk
This commit is contained in:
parent
b860d0e271
commit
8021d17d27
14 changed files with 19 additions and 1488 deletions
|
@ -6,7 +6,7 @@ from modules.globalvars import *
|
|||
from modules.volta.main import _
|
||||
import logging
|
||||
logger = logging.getLogger("goober")
|
||||
# Get file size and line count for a given file path
|
||||
|
||||
def get_file_info(file_path):
|
||||
try:
|
||||
file_size = os.path.getsize(file_path)
|
||||
|
@ -15,12 +15,8 @@ def get_file_info(file_path):
|
|||
return {"file_size_bytes": file_size, "line_count": len(lines)}
|
||||
except Exception as e:
|
||||
return {"error": str(e)}
|
||||
|
||||
# Load memory data from file, or use default dataset if not loaded yet
|
||||
def load_memory():
|
||||
data = []
|
||||
|
||||
# Try to load data from MEMORY_FILE
|
||||
try:
|
||||
with open(MEMORY_FILE, "r") as f:
|
||||
data = json.load(f)
|
||||
|
@ -28,12 +24,9 @@ def load_memory():
|
|||
pass
|
||||
|
||||
return data
|
||||
|
||||
# Save memory data to MEMORY_FILE
|
||||
def save_memory(memory):
|
||||
with open(MEMORY_FILE, "w") as f:
|
||||
json.dump(memory, f, indent=4)
|
||||
|
||||
def train_markov_model(memory, additional_data=None):
|
||||
if not memory:
|
||||
return None
|
||||
|
@ -45,14 +38,9 @@ def train_markov_model(memory, additional_data=None):
|
|||
text = "\n".join(filtered_memory)
|
||||
model = markovify.NewlineText(text, state_size=2)
|
||||
return model
|
||||
|
||||
# Save the Markov model to a pickle file
|
||||
def save_markov_model(model, filename='markov_model.pkl'):
|
||||
with open(filename, 'wb') as f:
|
||||
pickle.dump(model, f)
|
||||
logger.info(f"Markov model saved to {filename}.")
|
||||
|
||||
# Load the Markov model from a pickle file
|
||||
def load_markov_model(filename='markov_model.pkl'):
|
||||
try:
|
||||
with open(filename, 'rb') as f:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue