Package: hassil
HassILThe Home Assistant Intent Language (HassIL) parser forintents.DependenciesPyYAMLInstallationRun thescript/setupscript to automatically create a virtual environment and install the requirements.Runningpython3-mhassil<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-mhassilexamples/en.yaml--areas'living room'whatisthetemperatureinthelivingroom{'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-mhassilexamples/en.yaml--areasoffice--namestrapdoor
openthetrapdoorintheoffice{'intent':'HassOpenCover','name':'trapdoor','area':'office'}Sampling SentencesSentences for each intent can be sampled from the intent YAML files:python3-mhassil.sampleexamples/en.yaml-n1{"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--areasand--namesarguments are the same frompython3 -m hassil, but default to generic "area" and "entity" terms.Exclude the-nargument to sample all possible sentences.Sentence TemplatesUses a custom parser written in Python.Alternative words or phrases(red | green | blue)turn(s | ed | ing)Optional words or phrases[the][this | that]light[s]Permutations of words or phrases(patience; you must have) my young Padawanis [the] light (on; in <area>)Slot Lists{list_name}{list_name:slot_name}Refers to a pre-defined list of values in YAML (lists), either global or local (particular to the intent to which the sentence refers)Expansion Rules<rule_name>Refers to a pre-defined expansion rule in YAML (expansion_rules), either global or local (particular to the intent to which the sentence refers)YAML Formatlanguage:"<languagecode>"intents:<intent name>:data:# List of sentences/slots/etc.-sentences:-"<sentencetemplate>"-"<sentencetemplate>"# Optionalslots:# Fixed slots for the recognized intent<name>:<value>requires_context:# Must be present in match context<name>:# Any provided value is goodexcludes_context:# Must NOT be present in match context<name>:<value or list>expansion_rules:# Expansion rules which only apply to the intent, referenced as <rule_name><rule_name>:<sentence template>lists:# Lists which apply only to the current set of sentences, referenced as {list_name} or {list_name:slot_name}<list name>:values:# See below for other possible types-"items"-"inlist"metadata:# Arbitrary key/value pairs that will be available in the result<key>:<value># Optional lists of items that become alternatives in sentence templateslists:# Referenced as {list_name} or {list_name:slot_name}<list name>:values:-"items"-"inlist"-in:"textin"out:<value for slot># Optionalcontext:<name>:<value>metadata:# Arbitrary key/value pairs that will be available in the result<key>:<value><range_name>range:type:"number"from:0to:100# inclusive<wildcard_name>wildcard:true# Optional rules that are expanded in sentence templatesexpansion_rules:# Referenced as <rule_name><rule_name>:"<sentencetemplate>"# Optional words that the intent recognizer can skip during recognitionskip_words:-"<word>"