Eval2 test
This commit is contained in:
parent
6d44bf146f
commit
f28cbe8a28
22
eval2.py
22
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))
|
||||
|
Loading…
Reference in New Issue
Block a user