Constraint-driven gazetteer matcher for Home Assistant intents
Maintained. Last release 3 months ago, commits in 3 of the last 26 weeks. Weaker on commit activity and contributor spread.
pip install gazetteer-matcherGazetteer Matcher
An English-language, constraint-driven intent recognizer for Home Assistant voice commands. It complements Home Assistant's built-in sentence grammars by handling home-specific names, fuzzy wording, compound requests, and explicit conversation references while rejecting interpretations that do not fit the upstream intent schema.
Features
- Flexible and fuzzy target matching for entities, areas, floors, domains,
and actions:
turn on the bedrom lampresolves toBedroom Lamp. - Location-aware disambiguation from spoken qualifiers and voice-satellite
context:
bedroom TVselects the TV assigned to the bedroom. - Compound commands with multiple targets, intents, or properties:
turn off the kitchen lights and open the bedroom blinds. - Multiple actions on one target:
turn on the hallway light and set its brightness to 40%. - Explicit conversational follow-ups:
turn on the kitchen lightsfollowed byturn them off, oris the front door locked?followed bylock it. - Conservative, schema-backed validation with structured error categories and concise responses for ambiguous, unsupported, and out-of-range requests.
Install
pip install gazetteer-matcher
Runtime dependencies are home-assistant-intents, unicode-rbnf, and
PyYAML. A source install also attempts to build a self-contained C++17 fuzzy
scorer. Installation still succeeds without a compiler and uses the
behaviorally equivalent Python implementation instead.
For development:
pip install 'gazetteer-matcher[dev]'
pytest
Quick start
from gazetteer_matcher import GazetteerMatcher
matcher = GazetteerMatcher(
home={
"areas": {
"kitchen": {"name": "Kitchen", "floor": "ground"},
},
"floors": {
"ground": {"name": "Ground Floor"},
},
"entities": {},
}
)
result = matcher.interpret("flick on the kichen lights")
assert result.accepted
frame = result.frames[0]
assert frame.intent == "HassTurnOn"
assert frame.slots == {"area": "kitchen", "domain": "light"}
assert frame.response_key == "lights_area"
Pass the voice satellite's location when a command omits it: