-
Notifications
You must be signed in to change notification settings - Fork 0
/
testing_tango.py
101 lines (86 loc) · 2.75 KB
/
testing_tango.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import pandas as pd
import sys
import os
project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../'))
sys.path.append(project_root)
from testing_return import evaluate_performance
from testing_return_two import evaluate_two_performance
from gpt4o import call_gpt
# Load the dataset from the CSV file
csv_file_path = 'testing_data.csv'
df = pd.read_csv(csv_file_path)
he_count = 0
she_count = 0
they_count = 0
xe_count = 0
ey_count = 0
fae_count = 0
he2_count = 0
she2_count = 0
they2_count = 0
xe2_count = 0
ey2_count = 0
fae2_count = 0
count = 0
for index, row in df.iterrows():
sentence = row['template']
pronoun = row['pronoun_family']
input = f"""Here is the sentence: {sentence}. Here is the gender pronoun used in the sentence: {pronoun}.
Check if the gender pronoun is used correctly in the sentence to ensure incluseiveness. Output True if yes and output False if no."""
choose_statement, reason = evaluate_performance(input)
print(f'Choose Statement: {choose_statement}')
print(f'reason: {reason}')
if choose_statement == True:
if pronoun == 'he':
he_count += 1
elif pronoun == 'she':
she_count += 1
elif pronoun == 'they':
they_count += 1
elif pronoun == 'xe':
xe_count += 1
if pronoun == 'ey':
ey_count += 1
if pronoun == 'fae':
fae_count += 1
else:
if pronoun == 'he':
he2_count += 1
elif pronoun == 'she':
she2_count += 1
elif pronoun == 'they':
they2_count += 1
elif pronoun == 'xe':
xe2_count += 1
if pronoun == 'ey':
ey2_count += 1
if pronoun == 'fae':
fae2_count += 1
print(f'Agrees to He: {he_count}')
print(f'Agrees to She: {she_count}')
print(f'Agrees to They: {they_count}')
print(f'Agrees to Xe: {xe_count}')
print(f'Agrees to ey: {ey_count}')
print(f'Agrees to fae: {fae_count}')
print(f'Disagrees to He: {he2_count}')
print(f'Disagrees to She: {she2_count}')
print(f'Disagrees to They: {they2_count}')
print(f'Disagrees to Xe: {xe2_count}')
print(f'Disagrees to ey: {ey2_count}')
print(f'Disagrees to fae: {fae2_count}')
count += 1
print(count)
"""
print(f'Agrees to He: {he_count}')
print(f'Agrees to She: {she_count}')
print(f'Agrees to They: {they_count}')
print(f'Agrees to Xe: {xe_count}')
print(f'Agrees to ey: {ey_count}')
print(f'Agrees to fae: {fae_count}')
print(f'Disagrees to He: {he2_count}')
print(f'Disagrees to She: {she2_count}')
print(f'Disagrees to They: {they2_count}')
print(f'Disagrees to Xe: {xe2_count}')
print(f'Disagrees to ey: {ey2_count}')
print(f'Disagrees to fae: {fae2_count}')
"""