asahi417 commited on
Commit
1d03dae
·
1 Parent(s): 0160dcd

fix dataset

Browse files
Files changed (1) hide show
  1. process/tweet_ner.py +2 -0
process/tweet_ner.py CHANGED
@@ -21,6 +21,7 @@ label2id = {
21
  "I-product": 13,
22
  "O": 14
23
  }
 
24
 
25
 
26
  def decode_ner_tags(tag_sequence: List, input_sequence: List):
@@ -71,6 +72,7 @@ def process(tmp):
71
  for i in tmp:
72
  i.pop("id")
73
  entities = decode_ner_tags(i['tags'].tolist(), i['tokens'].tolist())
 
74
  pprint(entities)
75
  input()
76
  i['gold_label_sequence'] = i.pop('tags').tolist()
 
21
  "I-product": 13,
22
  "O": 14
23
  }
24
+ id2label = {v: k for k, v in label2id.items()}
25
 
26
 
27
  def decode_ner_tags(tag_sequence: List, input_sequence: List):
 
72
  for i in tmp:
73
  i.pop("id")
74
  entities = decode_ner_tags(i['tags'].tolist(), i['tokens'].tolist())
75
+ [e['types'] for e in entities]
76
  pprint(entities)
77
  input()
78
  i['gold_label_sequence'] = i.pop('tags').tolist()