fix: forget memoryの実装を「粗い」チェックに変更し、表層形の一致のみで判断するようにした

This commit is contained in:
Miwa / Ensan
2025-06-02 22:32:17 +09:00
parent 503c9171b2
commit 2569d8475e
3 changed files with 79 additions and 4 deletions

View File

@@ -226,6 +226,7 @@ struct LongTermLearningMemory {
debug("LongTermLearningMemory merge entryCount", entryCount, ltMetadata.count)
let forgetTargetWords = forgetTargets.map { $0.word }
// loudstxt3
for loudstxtIndex in 0 ..< Int(entryCount) / txtFileSplit + 1 {
let loudstxtData: Data
@@ -262,8 +263,8 @@ struct LongTermLearningMemory {
var newMetadata: [MetadataElement] = []
assert(elements.count == metadata.count, "elements count and metadata count must be equal.")
for (dicdataElement, metadataElement) in zip(elements, metadata) {
//
if forgetTargets.contains(dicdataElement) {
//
if forgetTargetWords.contains(dicdataElement.word) {
debug("LongTermLearningMemory merge stopped because it is a forget target", dicdataElement)
continue
}
@@ -564,8 +565,10 @@ struct TemporalLearningMemoryTrie {
}
}
//
// dataIndices(dicdata)
nodes[index].dataIndices.removeAll(where: {self.dicdata[$0] == dicdataElement})
//
nodes[index].dataIndices.removeAll {
self.dicdata[$0].word == dicdataElement.word
}
return true
}