Skip to content

Commit

Permalink
Add more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
synesthesiam committed Dec 14, 2022
1 parent 10dadf8 commit fa75328
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 3 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ Repository layout:
* [File format](sentences/README.md#file-format)
* `tests/<language>`
* YAML files for `<language>` with test sentences and corresponding intents
* [File format](sentences/README.md#file-format)
* [File format](tests/README.md#file-format)


## Supported Languages

* `en` - English


## Intents

See [intents.yaml](intents.yaml)
See [intents.yaml](intents.yaml) for available intent schemas.


## Lists
Expand Down
66 changes: 66 additions & 0 deletions parser/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# HassIL

The Home Assistant Intent Language (HassIL) parser.


## Dependencies

* antlr4-python3-runtime
* PyYAML
* dataclasses-json


## Installation

Create a virtual environment:

``` sh
python3 -m venv .venv
.venv/bin/pip3 install --upgrade pip
.venv/bin/pip3 install --upgrade wheel setuptools
```

Install dependencies:

``` sh
.venv/bin/pip3 install -r requirements.txt
```


# Running

``` sh
python3 -m hassil --language en
```

Once loaded, you may type in a sentence and see what intent it matches.
For example:

``` sh
what is the temperature in the living room
{'intent': 'HassClimateGetTemperature', 'area': 'living room', 'domain': 'climate'}
```

By default, the areas "kitchen", "bedroom", and "living room" are available. You can override this with `--areas`. Device or entity names can be provided with `--names`.

``` sh
python3 -m hassil --language en --areas office --names trapdoor
open the trapdoor in the office
{'intent': 'HassOpenCover', 'name': 'trapdoor', 'area': 'office'}
```


## Sentence Templates

* Alternative words or phrases
* `(red | green | blue)`
* Optional words or phrases
* `[the]`
* `[this | that]`
* Slot Lists
* `{list_name}`
* `{list_name:slot_name}`
* Refers to a pre-defined list of values in YAML
* Expansion Rules
* `<rule_name>`
* Refers to a pre-defined expansion rule in YAML
2 changes: 1 addition & 1 deletion sentences/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ skip_words:
* `[the]`
* `[this | that]`
* Slot Lists
* `{list_name}`
* `{list_name:slot_name}`
* In YAML, `list_name` should be under `lists`
* Expansion Rules
* `<rule_name>`
Expand Down

0 comments on commit fa75328

Please sign in to comment.