kiamehr74 commited on
Commit
4a33343
1 Parent(s): 3c659c0

labels added

Browse files
Files changed (1) hide show
  1. CoarseWSD-20.py +5 -3
CoarseWSD-20.py CHANGED
@@ -94,7 +94,9 @@ class CWSD20(datasets.GeneratorBasedBuilder):
94
  def _generate_examples(self, ex, lb):
95
  """Yields examples."""
96
  with open(ex, encoding="utf-8") as exf:
97
- for id_, exi in enumerate(exf):
 
 
98
  example = {}
99
  # 'word', 'sentence1', 'sentence2', 'start1', 'start2', 'end1', 'end2', 'idx', 'label'
100
  parts = exi.split("\t")
@@ -102,6 +104,6 @@ class CWSD20(datasets.GeneratorBasedBuilder):
102
  sent = parts[1]
103
  example["sentence"] = sent
104
  example["idx"] = idx
105
- example["label"] = 0
106
-
107
  yield id_, example
 
94
  def _generate_examples(self, ex, lb):
95
  """Yields examples."""
96
  with open(ex, encoding="utf-8") as exf:
97
+ with open(lb, encoding="utf-8") as lbf:
98
+
99
+ for id_, exi, lbi in enumerate(zip(exf, lbf)):
100
  example = {}
101
  # 'word', 'sentence1', 'sentence2', 'start1', 'start2', 'end1', 'end2', 'idx', 'label'
102
  parts = exi.split("\t")
 
104
  sent = parts[1]
105
  example["sentence"] = sent
106
  example["idx"] = idx
107
+ example["label"] = int(lbi)
108
+
109
  yield id_, example