nlplab / brat

brat rapid annotation tool (brat) - for all your textual annotation needs
http://brat.nlplab.org
Other
1.82k stars 509 forks source link

Cannot delete unconfigured relation #503

Open spyysalo opened 12 years ago

spyysalo commented 12 years ago

my config: small-EPI-test/PMID-12713659?focus=R1

trying to delete this annotation results in the following error

Traceback (most recent call last): 
File "/home/smp/public_html/brat/server/src/server.py", line 268, in serve 
return _safe_serve(params, client_ip, client_hostname) 
File "/home/smp/public_html/brat/server/src/server.py", line 163, in _safe_serve 
json_dic = dispatch(params, client_ip, client_hostname) 
File "/home/smp/public_html/brat/server/src/dispatch.py", line 189, in dispatch 
params) 
File "/home/smp/public_html/brat/server/src/annlog.py", line 83, in log_annotation 
_detab(str(other_params)))) 
NameError: global name 'other_params' is not defined 

(no time to log in detail, sorry)

ghost commented 12 years ago

@spyysalo: Won't there be a chance of this biting us for the experiments?

spyysalo commented 12 years ago

@ninjin: no; we will use configs that are appropriate for the annotations.

ghost commented 12 years ago

@spyysalo: Meh, my bad, didn't read the title properly

spyysalo commented 12 years ago

Tested this again, and on a recent version the crash is

File "/home/smp/public_html/brat/server/src/annotator.py", line 743, in delete_arc 
assert False, 'unknown annotation'

there's nothing very complicated about why this happens: this is the "else" branch on an if...else where the others are

if projectconf.is_equiv_type(type)

and

elif type in projectconf.get_relation_types():

so, there's basically no support for deleting unconfigured relations in the first place.

However, the code is missing an obvious trick here: as this relates to deleting an existing annotation, it's not necessary to know the config to determine whether or not it's an equiv; you can just look at the annotation itself.

Assigning @ninjin.