Auto-Fix Module (Quick Rule Entry Mode)¶
What it does¶
When you type a plain word (without quotes or Python syntax) into a map file
like FUZZY_MAP_pre.py, the system automatically converts it into a valid rule.
This is the fastest way to create new rules — no need to remember the format.
Example¶
You type this into FUZZY_MAP_pre.py:
oma
The auto-fix module detects a NameError (bare word, not valid Python)
and transforms the file automatically into:
# config/maps/.../de-DE/FUZZY_MAP_pre.py
import re # noqa: F401
# too<-from
FUZZY_MAP_pre = [
('oma', 'oma'),
]
Now edit the rule to what you actually need:
('Oma', 'oma'), # capitalize
('Großmutter', 'oma'), # synonym
('Thomas Müller', 'thomas'), # from a phone book
How it works¶
The module scripts/py/func/auto_fix_module.py is triggered automatically
when Aura detects a NameError while loading a map file.
It then:
Adds the correct file path header
Adds
import reif missingAdds the
FUZZY_MAP_pre = [list definitionConverts bare words into
('word', 'word'),tuplesCloses the list with
]
Rules and Limits¶
Only works on files smaller than 1KB (safety limit)
Only applies to:
FUZZY_MAP.py,FUZZY_MAP_pre.py,PUNCTUATION_MAP.pyThe file must be in a valid language folder (e.g.
de-DE/)Works for multiple words at once (e.g. from a phone book list)
Known Issues (not fully tested)¶
⚠️ This module is functional but not exhaustively tested. The following cases may not work correctly:
Numbers –
5or6are not valid Python identifiers, auto-fix may not handle themSpecial characters – words with
-,., umlauts may not trigger aNameErrorMulti-word entries –
thomas mueller(with space) causesSyntaxErrornotNameError, so auto-fix may not triggerComma-separated values –
drei, viermay be inserted as-is without becoming a proper tuple
If auto-fix does not trigger, add the rule manually:
('replacement', 'input word'),
The # too<-from comment¶
This comment is added automatically as a reminder of the rule direction:
too <- from
Meaning: output (too) ← input (from). The replacement comes first.
For PUNCTUATION_MAP.py the direction is reversed: # from->too
Bulk entry from a list¶
You can paste multiple words at once:
thomas
maria
berlin
Each bare word becomes its own rule:
('thomas', 'thomas'),
('maria', 'maria'),
('berlin', 'berlin'),
Then edit each replacement as needed.