new evaluate

This commit is contained in:
Bartosz 2021-05-17 14:13:45 +02:00
parent be71442103
commit c852703065

View File

@ -20,14 +20,17 @@ for file_name in os.listdir('data'):
for row in data: for row in data:
rows += 1 rows += 1
sentence = row[1] sentence = row[1]
for grammar in grammars: sentences = sentence.split(',')
match = grammar.find_matching_rules(sentence) for sentence in sentences:
if match: for grammar in grammars:
acts = row[2].split('&') match = grammar.find_matching_rules(sentence)
for act in acts: if match:
user_act = re.search(PATTERN, act).group() acts = row[2].split('&')
if user_act == grammar.name: for act in acts:
hits += 1 user_act = re.search(PATTERN, act).group()
if user_act == grammar.name:
print(grammar.name)
hits += 1
print(f"Accuracy: {(hits / rows)*100}") print(f"Accuracy: {(hits / rows)*100}")
# Dokładność 30% # Dokładność 44.6%