Spaces:
Sleeping
Sleeping
File size: 1,013 Bytes
d141565 0598506 d141565 0598506 d141565 0598506 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
from sentence_transformers import SentenceTransformer
from sklearn.cluster import KMeans
from memory_utils import get_history, decrypt_data
import numpy as np
class QuantumLearner:
def __init__(self):
# Koristimo lightweight multi-jezički model
self.model = SentenceTransformer('paraphrase-multilingual-MiniLM-L12-v2')
self.model.max_seq_length = 256 # Optimizacija za performanse
def analyze_conversations(self, history_limit=1000):
"""Analizira razgovore i pronalazi ključne teme"""
try:
history = get_history(limit=history_limit)
if not history:
return {"info": "Nema dostupne povijesti za analizu"}
# Dekriptiraj i kombinuj poruke
texts = [
f"{decrypt_data(row[2])} → {decrypt_data(row[3])}"
for row in history
if len(row) >= 4 # Zaštita od nepotpunih podataka
]
# Vektorizacija teksta |