Skip to content

Commit

Permalink
Fix bug when interpreting SY1 and SY2
Browse files Browse the repository at this point in the history
  • Loading branch information
RikVN committed Oct 21, 2021
1 parent 94ddc2d commit 6def45b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions evaluation/counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def get_clause_id(clause):
'''Get individual clause ID, e.g. Theme, work, IMP
However, for concepts we also want the sense!'''
spl_line = clause.split()
if all_upper(spl_line[1]) or is_role(spl_line[1]):
if all_upper(spl_line[1]) or spl_line[1] in ['SY1', 'SY2'] or is_role(spl_line[1]):
return spl_line[1]
else:
return spl_line[1] + '.' + spl_line[2].replace('"','') #get sense without quotes
Expand All @@ -302,7 +302,7 @@ def get_num_concepts(clause_list, pos_tag):
'''Get the number of concepts with a certain pos-tag'''
num_concepts = 0
for clause in clause_list:
if not all_upper(clause[1]) and not is_role(clause[1]):
if not all_upper(clause[1]) and not is_role(clause[1]) and not clause[1] in ['SY1', 'SY2']:
try:
cur_pos_tag = clause[2].split('.')[0][-1]
if cur_pos_tag == 's':
Expand All @@ -323,7 +323,7 @@ def get_detailed_results(match):
spl_line = clause.split()
if '%' in spl_line:
spl_line = spl_line[0:spl_line.index('%')]
if all_upper(spl_line[1]):
if all_upper(spl_line[1]) or spl_line[1] in ['SY1', 'SY2']:
match_division[0] += 1
elif is_role(spl_line[1]):
match_division[1] += 1
Expand Down Expand Up @@ -695,7 +695,7 @@ def get_specific_clauses(self, clause_list, en_sense_dict, args):
else:
# First item always is a box variable
val0 = self.rename_var(cur_clause[0], 'b', args)
if all_upper(cur_clause[1]): # Second item is an operator
if all_upper(cur_clause[1]) or cur_clause[1] in ['SY1', 'SY2']: # Second item is an operator
self.add_operator_clauses(val0, cur_clause, idx, args)
elif is_role(cur_clause[1]): # Second item is a role
self.add_role_clauses(cur_clause, val0, idx, args)
Expand All @@ -719,7 +719,7 @@ def save_detailed_stats(all_dicts, args):
# Create lists to print when looping over the sorted dictionary
for w in sorted(f_dict, key=f_dict.get, reverse=True):
if final_dict[w][1] >= args.detailed_stats or final_dict[w][2] >= args.detailed_stats: #only print if it has a minimum occurrence in prod or gold
if all_upper(w):
if all_upper(w) or w in ['SY1', 'SY2']:
print_list[0].append([w, str(f_dict[w]), str(final_dict[w][1]), str(final_dict[w][2]), str(final_dict[w][0])])
elif is_role(w):
print_list[1].append([w, str(f_dict[w]), str(final_dict[w][1]), str(final_dict[w][2]), str(final_dict[w][0])])
Expand Down
2 changes: 1 addition & 1 deletion evaluation/hill_climbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def same_edge_type_check(edge1, edge2):
concepts: verb
operators: REF, EQU'''

if edge1.isupper() and edge2.isupper(): # operator
if (edge1.isupper() and edge2.isupper()) or (edge1 in ['SY1', 'SY2'] and edge in ['SY1', 'SY2']): # operator
return True
elif edge1[0].isupper() and edge1[1:].islower() and edge2[0].isupper() and edge2[1:].islower(): # role
return True
Expand Down

0 comments on commit 6def45b

Please sign in to comment.