Remove unused stopwords, conversation regex, and query expansions from chat memory module
This commit is contained in:
@@ -15,33 +15,6 @@ DEFAULT_MEMORY_TOP_K = 4
|
||||
DEFAULT_MEMORY_CONTEXT_CHARS = 3600
|
||||
_TOKEN_RE = re.compile(r"[\w][\w'_-]*", re.UNICODE)
|
||||
_THINK_RE = re.compile(r"<think(?:ing)?>.*?</think(?:ing)?>", re.IGNORECASE | re.DOTALL)
|
||||
_STOPWORDS = {
|
||||
"about", "again", "also", "and", "are", "but", "can", "could", "did", "does", "for",
|
||||
"from", "had", "has", "have", "how", "into", "just", "like", "more", "not", "now",
|
||||
"our", "out", "over", "please", "should", "that", "the", "then", "there", "this",
|
||||
"was", "were", "what", "when", "where", "which", "with", "would", "you", "your",
|
||||
"all", "anything", "chat", "chats", "conversation", "conversations", "discuss",
|
||||
"discussed", "everything", "list", "me", "talk", "talked", "tell", "topic", "topics",
|
||||
"aber", "als", "auch", "auf", "aus", "bei", "bin", "bis", "das", "dem", "den",
|
||||
"der", "des", "die", "ein", "eine", "einem", "einen", "einer", "erzaehl", "erzähl",
|
||||
"erzähle", "für", "ging", "hat", "ich", "ist", "letzte", "letzten", "letztes", "mir",
|
||||
"mit", "nicht", "oder", "sich", "sind", "und", "uns", "über", "ueber", "von",
|
||||
"war", "was", "wie", "wir", "worum", "zu", "zum", "zur",
|
||||
}
|
||||
_LAST_CONVERSATION_RE = re.compile(
|
||||
r"\b(last|latest|previous|prior)\s+(chat|conversation|session)\b"
|
||||
r"|\b(letzte[sn]?|vorherige[sn]?)\s+(gespr[aä]ch|chat|unterhaltung)\b"
|
||||
r"|\bworum\s+ging\s+es\s+im\s+letzte[sn]?\s+gespr[aä]ch\b",
|
||||
re.IGNORECASE,
|
||||
)
|
||||
_QUERY_EXPANSIONS = {
|
||||
"music": ["song", "songs", "album", "albums", "artist", "artists", "band", "bands", "lied", "lieder", "musik"],
|
||||
"musik": ["music", "song", "songs", "album", "albums", "artist", "artists", "band", "bands", "lied", "lieder"],
|
||||
"song": ["music", "songs", "lied", "lieder", "musik"],
|
||||
"songs": ["music", "song", "lied", "lieder", "musik"],
|
||||
"lied": ["music", "musik", "song", "songs", "lieder"],
|
||||
"lieder": ["music", "musik", "song", "songs", "lied"],
|
||||
}
|
||||
|
||||
|
||||
def ensure_chat_memory_schema(engine) -> None:
|
||||
|
||||
Reference in New Issue
Block a user