Add 'nlu.py'
This commit is contained in:
parent
c11e6ea284
commit
b6411ae7d0
14
nlu.py
Normal file
14
nlu.py
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import jsgf
|
||||||
|
|
||||||
|
order_grammar = jsgf.parse_grammar_file('order.jsgf')
|
||||||
|
order_grammar
|
||||||
|
|
||||||
|
|
||||||
|
utterance = 'chciałbym zamowic pizze vesuvio XXL na dwie osoby'
|
||||||
|
matched = order_grammar.find_matching_rules(utterance)
|
||||||
|
|
||||||
|
|
||||||
|
def get_dialog_act(rule):
|
||||||
|
slots = []
|
||||||
|
get_slots(rule.expansion, slots)
|
||||||
|
return {'act': rule.grammar.name, 'slots': slots}
|
Loading…
Reference in New Issue
Block a user