omniquad commited on
Commit
413390d
1 Parent(s): 7d5ce73

Update BC5CDR-IOB .py

Browse files
Files changed (1) hide show
  1. BC5CDR-IOB .py +10 -8
BC5CDR-IOB .py CHANGED
@@ -120,14 +120,16 @@ class Bc4chemdNer(datasets.GeneratorBasedBuilder):
120
  # tokens are tab separated
121
  splits = line.split("\t")
122
  tokens.append(splits[0])
123
- if(splits[1].rstrip()=="B-Chemical"):
124
- ner_tags.append("B-CHEMICAL")
125
- if(splits[1].rstrip()=="I-Chemical"):
126
- ner_tags.append("I-CHEMICAL")
127
- if(splits[1].rstrip()=="B-Disease"):
128
- ner_tags.append("B-DISEASE")
129
- if(splits[1].rstrip()=="I-Disease"):
130
- ner_tags.append("I-DISEASE")
 
 
131
  else:
132
  ner_tags.append("O")
133
 
 
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