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