The Home Assistant Intent Language parser
Actively maintained. Last release 6 days ago, commits in 17 of the last 26 weeks. A safe choice.
pip install hassilHassIL
The Home Assistant Intent Language (HassIL) parser for intents.
Dependencies
- PyYAML
Installation
Run the script/setup script to automatically create a virtual environment and install the requirements.
Running
python3 -m hassil <yaml_file_or_directory> [<yaml_file_or_directory> ...]
Once loaded, you may type in a sentence and see what intent it matches. For example:
python3 -m hassil examples/en.yaml --areas 'living room'
what is the temperature in the living room
{'intent': 'HassClimateGetTemperature', 'area': 'living room', 'domain': 'climate'}
Make sure to provide area names with --areas. Device or entity names can be provided with --names.
python3 -m hassil examples/en.yaml --areas office --names trapdoor
open the trapdoor in the office
{'intent': 'HassOpenCover', 'name': 'trapdoor', 'area': 'office'}
Sampling Sentences
Sentences for each intent can be sampled from the intent YAML files:
python3 -m hassil.sample examples/en.yaml -n 1
{"intent": "HassTurnOn", "text": "turn on the entity"}
{"intent": "HassTurnOff", "text": "turn off the entity"}
{"intent": "HassOpenCover", "text": "open the entity in the area"}
{"intent": "HassCloseCover", "text": "close the entity in the area"}
{"intent": "HassLightsSet", "text": "set the entity color to red"}
{"intent": "HassClimateSetTemperature", "text": "set temperature to 0 degrees in the area"}
{"intent": "HassClimateGetTemperature", "text": "what is the temperature in the area"}
The --areas and --names arguments are the same from python3 -m hassil, but default to generic "area" and "entity" terms.
Exclude the -n argument to sample all possible sentences.
Sentence Templates
Uses a custom parser written in Python.
- Alternative words or phrases
(red|green|blue)turn(s|ed|ing)
- Optional words or phrases
[the][this|that]