From 7b8937a98a58a5b3c84ac25d82f7928254218ece Mon Sep 17 00:00:00 2001 From: Yevhenii Poliakov Date: Thu, 4 May 2023 12:58:32 +0200 Subject: [PATCH] add new grammars --- example_nlu.py | 6 +++--- grammar3.jsgf | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/example_nlu.py b/example_nlu.py index f16e5bb..a505d5c 100644 --- a/example_nlu.py +++ b/example_nlu.py @@ -4,7 +4,7 @@ import os __location__ = Path().resolve() -book_grammar = jsgf.parse_grammar_file(os.path.join(__location__, "grammar1.jsgf")) +book_grammar = jsgf.parse_grammar_file(os.path.join(__location__, "grammar3.jsgf")) book_grammar @@ -35,10 +35,10 @@ def nlu(utterance): -utterance = 'Cześć dodaj ser' +utterance = 'kup dwie baterie' matched = book_grammar.find_matching_rules(utterance) matched -nlu('Cześć dodaj ser') +nlu('kup dwie baterie') get_dialog_act(matched[0]) \ No newline at end of file diff --git a/grammar3.jsgf b/grammar3.jsgf index 5230d8a..9a5fba0 100644 --- a/grammar3.jsgf +++ b/grammar3.jsgf @@ -1,6 +1,4 @@ -#JSGF V1.0; -grammar zakupyOnline; -@charset "UTF-8"; +#JSGF V1.0 UTF-8; grammar zakupyOnline; @@ -32,7 +30,7 @@ public = | | | = filtruj według ; - = (ceny rosnącą | ceny malejąco | marka | kolor | rozmiar | ranking | dostępność); + = (ceny rosnąco | ceny malejąco | dostępność | marka | kolor | rozmiar | ranking ); = (Coca-Cola | Pepsi | Dr. Pepper | Tiger | Milka | L'Oreal | Procter & Gamble | Samsung | Apple | Sony);