-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from home-assistant/synesthesiam-20241025-fas…
…ter-recognizer Faster and more accurate recognition
- Loading branch information
Showing
20 changed files
with
2,144 additions
and
1,422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.8.0 | ||
2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
"""Errors for hassil.""" | ||
|
||
|
||
class HassilError(Exception): | ||
"""Base class for hassil errors""" | ||
|
||
|
||
class MissingListError(HassilError): | ||
"""Error when a {slot_list} is missing.""" | ||
|
||
|
||
class MissingRuleError(HassilError): | ||
"""Error when an <expansion_rule> is missing.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
"""Shared models.""" | ||
|
||
from abc import ABC | ||
from dataclasses import dataclass | ||
from typing import Any, Dict, Optional, Union | ||
|
||
from .util import PUNCTUATION_ALL | ||
|
||
|
||
@dataclass | ||
class MatchEntity: | ||
"""Named entity that has been matched from a {slot_list}""" | ||
|
||
name: str | ||
"""Name of the entity.""" | ||
|
||
value: Any | ||
"""Value of the entity.""" | ||
|
||
text: str | ||
"""Original value text.""" | ||
|
||
metadata: Optional[Dict[str, Any]] = None | ||
"""Entity metadata.""" | ||
|
||
is_wildcard: bool = False | ||
"""True if entity is a wildcard.""" | ||
|
||
is_wildcard_open: bool = True | ||
"""While True, wildcard can continue matching.""" | ||
|
||
@property | ||
def text_clean(self) -> str: | ||
"""Trimmed text with punctuation removed.""" | ||
return PUNCTUATION_ALL.sub("", self.text.strip()) | ||
|
||
|
||
@dataclass | ||
class UnmatchedEntity(ABC): | ||
"""Base class for unmatched entities.""" | ||
|
||
name: str | ||
"""Name of entity that should have matched.""" | ||
|
||
|
||
@dataclass | ||
class UnmatchedTextEntity(UnmatchedEntity): | ||
"""Text entity that should have matched.""" | ||
|
||
text: str | ||
"""Text that failed to match slot values.""" | ||
|
||
is_open: bool = True | ||
"""While True, entity can continue matching.""" | ||
|
||
|
||
@dataclass | ||
class UnmatchedRangeEntity(UnmatchedEntity): | ||
"""Range entity that should have matched.""" | ||
|
||
value: Union[int, float] | ||
"""Value of entity that was out of range.""" |
Oops, something went wrong.