From 6d44bf146f02211bc80226b71b316e401928efd5 Mon Sep 17 00:00:00 2001 From: Maciej Sobkowiak Date: Mon, 17 May 2021 15:10:16 +0200 Subject: [PATCH] eval2 test --- eval2.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 eval2.py diff --git a/eval2.py b/eval2.py new file mode 100644 index 0000000..0a235aa --- /dev/null +++ b/eval2.py @@ -0,0 +1,32 @@ +from datetime import date +import jsgf +import pandas as pd +import numpy as np +import os + +gramar = jsgf.parse_grammar_file('book.jsgf') +print(gramar) + +rows = 0 +matches = 0 + +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 + +print(rows) +print(matches)