Unmatched Training Plugin (1_collect_unmatched_training)¶
Purpose¶
This plugin automatically collects unrecognized voice inputs and adds them as new variants to the fuzzy map regex. This allows the system to “self-train” over time by learning from unmatched recognition results.
How it works¶
The
COLLECT_UNMATCHEDcatch-all rule fires when no other rule matched.collect_unmatched.pyis called viaon_match_execwith the matched text.The regex in the calling
FUZZY_MAP_pre.pyis automatically extended.
Usage¶
Add this catch-all rule at the end of any FUZZY_MAP_pre.py you want to train:
from scripts.py.func.get_project_root import get_aura_project_root
from pathlib import Path
import os
SL5NET_AURA_PROJECT_ROOT = get_aura_project_root()
FUZZY_MAP_pre = [
# 1. Your rule to optimize (result first!)
('Blumen orchestrieren',
r'^(Blumen giesen|Blumen gessen|Blumen essen)$', 100,
{'command_flags': re.IGNORECASE}
),
#################################################
# 2. Activate this rule (place it after the rule you want to optimize)
(f'{str(__file__)}', r'^(.*)$', 10,
{'on_match_exec': [SL5NET_AURA_PROJECT_ROOT / 'config' / 'maps' / 'plugins' / '1_collect_unmatched_training' / 'collect_unmatched.py']}),
#################################################
]
The label f'{str(__file__)}' tells collect_unmatched.py exactly which
FUZZY_MAP_pre.py to update — so the rule is portable across any plugin.
Disabling the plugin¶
When you have collected enough training data, disable by either:
Commenting out the catch-all rule
Renaming the folder with an invalid name (e.g. add a space)
Removing the plugin folder from the
mapsdirectory
File structure¶
1_collect_unmatched_training/
├── collect_unmatched.py # Plugin logic, called by engine
└── de-DE/
└── FUZZY_MAP_pre.py # Example with catch-all rule
Note¶
The plugin modifies FUZZY_MAP_pre.py at runtime. Commit the updated
file regularly to preserve collected training data.