4 from __future__
import (absolute_import, division,
5 print_function, unicode_literals)
10 if __name__ ==
"__main__":
16 grammar_file = sys.argv[1]
19 grammar_file =
'current_grammar.fcfg'
22 dummy_model_path = os.path.dirname(os.path.realpath(__file__))
24 k =
Grammar(dummy_model_path, grammar_file, target)
27 subprocess_exit_status = subprocess.call([
"mkdynamicgrammar.bash",
28 k.model_path, k.model_path_tmp])
30 if subprocess_exit_status == 1:
31 raise Exception(
"Subprocess error")
33 test_sentence_1 =
"bring me the coke"
34 test_sentence_2 =
"bring the coke to the kitchen"
36 s1 = k.parse(test_sentence_1)
37 s2 = k.parse(test_sentence_2)
39 print(
"Parser output for '{}': ".format(test_sentence_1), s1)
40 print(
"Parser output for '{}': ".format(test_sentence_2), s2)