ruanchaves commited on
Commit
7a90f01
1 Parent(s): 9fb2ad1

add mix field

Browse files
Files changed (1) hide show
  1. hashset_manual.py +6 -10
hashset_manual.py CHANGED
@@ -46,8 +46,7 @@ class HashSetManual(datasets.GeneratorBasedBuilder):
46
  ),
47
  "source": datasets.Value("string"),
48
  "gold_position": datasets.Value("int32"),
49
- "english": datasets.Value("bool"),
50
- "hindi": datasets.Value("bool"),
51
  "other": datasets.Value("bool"),
52
  "ner": datasets.Value("bool"),
53
  "annotator_id": datasets.Value("int32"),
@@ -85,18 +84,16 @@ class HashSetManual(datasets.GeneratorBasedBuilder):
85
  except json.decoder.JSONDecodeError:
86
  record = {"choices": [field]}
87
 
88
- english = False
89
- hindi = False
90
  other = False
91
  ner = False
92
  if mix_label in record["choices"]:
93
- english = True
94
- hindi = True
95
  if other_label in record["choices"]:
96
  other = True
97
  if ner_label in record["choices"]:
98
  ner = True
99
- return english, hindi, other, ner
100
 
101
  def read_entities(field):
102
  try:
@@ -130,7 +127,7 @@ class HashSetManual(datasets.GeneratorBasedBuilder):
130
 
131
  records = pd.read_csv(filepath).to_dict("records")
132
  for idx, row in enumerate(records):
133
- english, hindi, other, ner = read_language_labels(row["mutlitoken"])
134
  yield idx, {
135
  "index": row["Unnamed: 0"],
136
  "hashtag": row["Hashtag"],
@@ -138,8 +135,7 @@ class HashSetManual(datasets.GeneratorBasedBuilder):
138
  "spans": read_entities(row["charner"]),
139
  "source": row["Source"],
140
  "gold_position": get_gold_position(row["topk"]),
141
- "english": english,
142
- "hindi": hindi,
143
  "other": other,
144
  "ner": ner,
145
  "annotator_id": int(row["annotator"]),
 
46
  ),
47
  "source": datasets.Value("string"),
48
  "gold_position": datasets.Value("int32"),
49
+ "mix": datasets.Value("bool"),
 
50
  "other": datasets.Value("bool"),
51
  "ner": datasets.Value("bool"),
52
  "annotator_id": datasets.Value("int32"),
 
84
  except json.decoder.JSONDecodeError:
85
  record = {"choices": [field]}
86
 
87
+ mix = False
 
88
  other = False
89
  ner = False
90
  if mix_label in record["choices"]:
91
+ mix = True
 
92
  if other_label in record["choices"]:
93
  other = True
94
  if ner_label in record["choices"]:
95
  ner = True
96
+ return mix, other, ner
97
 
98
  def read_entities(field):
99
  try:
 
127
 
128
  records = pd.read_csv(filepath).to_dict("records")
129
  for idx, row in enumerate(records):
130
+ mix, other, ner = read_language_labels(row["mutlitoken"])
131
  yield idx, {
132
  "index": row["Unnamed: 0"],
133
  "hashtag": row["Hashtag"],
 
135
  "spans": read_entities(row["charner"]),
136
  "source": row["Source"],
137
  "gold_position": get_gold_position(row["topk"]),
138
+ "mix": mix,
 
139
  "other": other,
140
  "ner": ner,
141
  "annotator_id": int(row["annotator"]),