new evaluate

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

View File

@ -20,6 +20,8 @@ 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]
sentences = sentence.split(',')
for sentence in sentences:
for grammar in grammars: for grammar in grammars:
match = grammar.find_matching_rules(sentence) match = grammar.find_matching_rules(sentence)
if match: if match:
@ -27,7 +29,8 @@ for file_name in os.listdir('data'):
for act in acts: for act in acts:
user_act = re.search(PATTERN, act).group() user_act = re.search(PATTERN, act).group()
if user_act == grammar.name: if user_act == grammar.name:
print(grammar.name)
hits += 1 hits += 1
print(f"Accuracy: {(hits / rows)*100}") print(f"Accuracy: {(hits / rows)*100}")
# Dokładność 30% # Dokładność 44.6%