omniquad commited on
Commit
ed1f8fe
·
1 Parent(s): 51ceccf

Update BioNLP11ID-ggp-IOB.py

Browse files
Files changed (1) hide show
  1. BioNLP11ID-ggp-IOB.py +14 -13
BioNLP11ID-ggp-IOB.py CHANGED
@@ -119,19 +119,20 @@ class Bc4chemdNer(datasets.GeneratorBasedBuilder):
119
  else:
120
  # tokens are tab separated
121
  splits = line.split("\t")
122
- tokens.append(splits[0])
123
- if "B-" in splits[1].rstrip() or "I-" in splits[1].rstrip():
124
- ner_tags.append(splits[1].rstrip().upper())
125
- # if(splits[1].rstrip()=="B-Chemical"):
126
- # ner_tags.append("B-CHEMICAL")
127
- # if(splits[1].rstrip()=="I-Chemical"):
128
- # ner_tags.append("I-CHEMICAL")
129
- # if(splits[1].rstrip()=="B-Disease"):
130
- # ner_tags.append("B-DISEASE")
131
- # if(splits[1].rstrip()=="I-Disease"):
132
- # ner_tags.append("I-DISEASE")
133
- else:
134
- ner_tags.append("O")
 
135
 
136
  # last example
137
  yield guid, {
 
119
  else:
120
  # tokens are tab separated
121
  splits = line.split("\t")
122
+ if len(splits)==2:
123
+ tokens.append(splits[0])
124
+ if "-" in splits[1].rstrip():
125
+ ner_tags.append(splits[1].rstrip().upper())
126
+ # if(splits[1].rstrip()=="B-Chemical"):
127
+ # ner_tags.append("B-CHEMICAL")
128
+ # if(splits[1].rstrip()=="I-Chemical"):
129
+ # ner_tags.append("I-CHEMICAL")
130
+ # if(splits[1].rstrip()=="B-Disease"):
131
+ # ner_tags.append("B-DISEASE")
132
+ # if(splits[1].rstrip()=="I-Disease"):
133
+ # ner_tags.append("I-DISEASE")
134
+ else:
135
+ ner_tags.append("O")
136
 
137
  # last example
138
  yield guid, {