Replaced a hardcoded keyword map with ordered user-defined rules.
Conversation
Turn 1 — User
Category matching is a giant if-chain. I want to define my own rules.
Turn 2 — Assistant
Replaced it with an ordered rule list loaded from config: each rule has a matcher and a category, first match wins, and an explicit fallback catches the rest.
Ordering is the whole design — the previous behaviour depended on dictionary order, which was accidental.
Turn 3 — User
Can a rule match on amount as well as description?
Turn 4 — Assistant
Yes, and the two combine with an implicit and. There is a test for a rule matching only above a threshold, since that was the case the old code could not express at all.
Subjects
- [[Python]]
- [[Configuration]]