add new grammars

This commit is contained in:
Yevhenii Poliakov 2023-05-04 12:58:32 +02:00
parent 2a1f03b365
commit 7b8937a98a
2 changed files with 5 additions and 7 deletions

View File

@ -4,7 +4,7 @@ import os
__location__ = Path().resolve() __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 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 = book_grammar.find_matching_rules(utterance)
matched matched
nlu('Cześć dodaj ser') nlu('kup dwie baterie')
get_dialog_act(matched[0]) get_dialog_act(matched[0])

View File

@ -1,6 +1,4 @@
#JSGF V1.0; #JSGF V1.0 UTF-8;
grammar zakupyOnline;
@charset "UTF-8";
grammar zakupyOnline; grammar zakupyOnline;
@ -32,7 +30,7 @@ public <command> = <buyCommand> | <cartCommand> | <filterCommand> | <searchComma
<filterCommand> = filtruj według <filterType>; <filterCommand> = filtruj według <filterType>;
<filterType> = (ceny rosnącą | ceny malejąco | marka <brandName> | kolor <colorName> | rozmiar <sizeType> | ranking <ratingType> | dostępność); <filterType> = (ceny rosnąco | ceny malejąco | dostępność | marka <brandName> | kolor <colorName> | rozmiar <sizeType> | ranking <ratingType>);
<brandName> = (Coca-Cola | Pepsi | Dr. Pepper | Tiger | Milka | L'Oreal | Procter & Gamble | Samsung | Apple | Sony); <brandName> = (Coca-Cola | Pepsi | Dr. Pepper | Tiger | Milka | L'Oreal | Procter & Gamble | Samsung | Apple | Sony);