Skip to content

Commit

Permalink
bug fix: use original partid's on annjson creation -- everything work…
Browse files Browse the repository at this point in the history
…s fine if html partid's are good
  • Loading branch information
juanmirocks committed Feb 17, 2016
1 parent b05fd81 commit c541aab
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions nalaf/utils/writers.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,17 +331,10 @@ def export_ann_json(self, threshhold_value=None):
fname = os.path.join(self.annjson_path, pubmedid + ".ann.json")
print_verbose(fname)
with open(fname, 'w', encoding='utf-8') as f:

# conversion keys partids into normalised tagtog-compatible format
part_ids_raw = list(doc.parts.keys())
part_ids_normalised = []
for i, partid in enumerate(part_ids_raw):
part_ids_normalised.append("s1p{}".format(i + 1))

# init empty json-object
json_obj = {
"annotatable": {
"parts" : part_ids_normalised
"parts" : list(doc.parts.keys())
},
"anncomplete": False,
"sources": [
Expand Down Expand Up @@ -391,10 +384,9 @@ def export_ann_json(self, threshhold_value=None):
# "confidence": 1 # todo discussion confidence from GNormPlus is not provided so just putting in here 1
}

tagtog_part_id = "s1p{}".format(i + 1)
ent = {
"classId": ann.class_id,
"part": tagtog_part_id,
"part": partid,
"offsets": [{"start": ann.offset, "text": ann.text}],
"confidence": {
"state": state,
Expand Down

0 comments on commit c541aab

Please sign in to comment.