diff --git a/eval2.py b/eval2.py index 0a235aa..22ee566 100644 --- a/eval2.py +++ b/eval2.py @@ -3,6 +3,9 @@ import jsgf import pandas as pd import numpy as np import os +from NaturalLanguageUnderstanding import NLU + +nlu = NLU() gramar = jsgf.parse_grammar_file('book.jsgf') print(gramar) @@ -14,19 +17,18 @@ for f in os.listdir('data'): dialog = pd.read_csv(f'data/{f}', sep='\t') dialog = dialog.loc[dialog['Interlocutor'] == 'user'] - # print(dialog) - for index, row in dialog.iterrows(): rows += 1 match = gramar.find_matching_rules(row['Text']) if match: - matches += 1 - print(match) acts = row['Acts'].split('&') - print(acts) - else: - # print("not match") - pass + for act in acts: -print(rows) -print(matches) + frame = nlu.parse_user_input(row['Text']) + frame_act_name = frame.getActType().name.lower() + if frame_act_name in act.strip(): + matches += 1 + + +print("Rows processed: " + str(rows)) +print("Accuracy: " + str(matches/rows*100))