mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-08-26 20:53:20 +00:00
docs(search): correct the recall claim in the pattern normalizer
The docstring said a shorter prefix "only widens recall". That holds for a stem that truncates, not for one that substitutes: English y -> i moves the pattern sideways, so "copy*" gains "copies" and loses "copyright". Stating it as a general invariant is what hid that class in the first place. Length stays the rule; only its justification is corrected. No behavior change -- no executable line is touched. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
e48182c358
commit
95b600ebdd
@@ -34,8 +34,12 @@ def _make_pattern_normalizer(language: str | None) -> Callable[[str], str]:
|
||||
therefore stemmed here too.
|
||||
|
||||
A stem can be longer than the fragment the user typed, though, and a
|
||||
longer prefix matches nothing while a shorter one only widens recall,
|
||||
so the stem is used only when it is no longer than the typed run.
|
||||
longer prefix matches nothing, so the stem is used only when it is no
|
||||
longer than the typed run. Length is a proxy for "the stem stayed close
|
||||
to what was typed", not a guarantee of wider recall: a stem that
|
||||
substitutes rather than truncates ("copy" -> "copi") moves the pattern
|
||||
sideways instead of widening it, so "copy*" gains "copies" and loses
|
||||
"copyright". test_pattern_stemming.py pins that trade.
|
||||
"""
|
||||
folded = ascii_fold(text.lower())
|
||||
stemmed = stem_pattern_text(folded, language)
|
||||
|
||||
Reference in New Issue
Block a user