Skip to content

Commit

Permalink
Validate to guard no question marks added to sentences (home-assistan…
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob authored Dec 28, 2022
1 parent 144e7b0 commit 28a2752
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion script/intentfest/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,19 @@ def validate(value):
"handle_error",
}

SENTENCE_MATCHER = vol.Match(
r"^[\w \|\(\)\[\]\{\}\<\>]+$",
msg="Sentences should only contain words and matching syntax. They should not contain punctuation.",
)

SENTENCE_SCHEMA = vol.Schema(
{
vol.Required("language"): str,
vol.Optional("intents"): {
str: {
vol.Required("data"): [
{
vol.Required("sentences"): [str],
vol.Required("sentences"): [SENTENCE_MATCHER],
vol.Optional("slots"): {
str: match_anything,
},
Expand Down

0 comments on commit 28a2752

Please sign in to comment.