Skip to content

fix(memory): keep numbers and emphasis words out of extracted entities - #169

Open
audreyt wants to merge 1 commit into
mnemon-dev:masterfrom
audreyt:fix/entity-noise-tokens
Open

audreyt wants to merge 1 commit into
mnemon-dev:masterfrom
audreyt:fix/entity-noise-tokens

Conversation

@audreyt

@audreyt audreyt commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

What

Two filters in ExtractEntities:

  • File-path matches must contain a letter and at least one dot-separated segment longer than one character. Decimals, versions, and addresses (0.52, 127.0.0.1) and dotted abbreviations (e.g, i.e, p.4) no longer pass; cmd/root.go, llama.cpp, and example.org still do.
  • acronymStopwords gains ordinary words written in capitals for emphasis or as labels (NEVER, ONLY, BOTH, PASS, NOTE, FIXED, ...). Words that double as technical names (HEAD, POST, PATH, HOME, REST, DELETE, LINE) stay out of the list, and real acronyms (API, HTTP, SQL) are unaffected.

Why

The file-path pattern ([.\w/-]+\.\w{1,10}) matches any dotted token, and the acronym pattern matches any 2-6 letter all-caps word. On a long-lived personal store of several thousand insights, about 3,700 stored entities were bare numbers, e.g alone sat on nearly 500 insights, and the most frequent all-caps entities included ONLY, PASS, BOTH, NEVER, and LESSON, each on 200 to 350 insights. Every one of them becomes an entity edge between memories that share nothing but a decimal or an emphasis word. The frequency gate from #160 only filters the wide-cast path, so it does not catch these strict-regex matches.

Effect

New writes and recall query entities stop admitting these tokens. Insights keep the entities they already stored, and edges built from them stay until a rebuild.

Validation

  • TestExtractEntities_FilePathsSkipNumbersAndAbbreviations and TestExtractEntities_EmphasisWordsAreNotAcronyms fail on master ("0.52" must not be an entity, "NEVER" must not be an entity) and pass here.
  • gofmt -l is clean and make test (including go vet ./...) passes.

Release note

Entity extraction no longer stores decimals, dotted abbreviations, or capitalized emphasis words as entities.

The file-path pattern also matched decimals, versions, and addresses with no
letter (0.52, 127.0.0.1) and dotted abbreviations (e.g, i.e), and the acronym
pattern admitted ordinary words written in capitals for emphasis or as labels
(NEVER, ONLY, NOTE, FIXED). On a real store these were among the most frequent
stored entities, and entity edges linked memories that shared nothing but a
decimal or an emphasis word.

File-path matches now need a letter and a dot-separated segment longer than
one character, and the acronym stoplist gains the emphasis words while leaving
out words that double as technical names (HEAD, POST, PATH). Validated with
make test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant