tkon3 commited on
Commit
e41a1f5
·
1 Parent(s): e5a3696
Files changed (1) hide show
  1. arxiv-classification.py +8 -1
arxiv-classification.py CHANGED
@@ -51,12 +51,16 @@ class ArxivClassificationDataset(datasets.GeneratorBasedBuilder):
51
  _LABELS_DICT = {label: i for i, label in enumerate(_LABELS)}
52
 
53
  BUILDER_CONFIGS = [
54
-
55
  ArxivClassificationConfig(
56
  name="arxiv",
57
  version=datasets.Version("1.0.0"),
58
  description="Arxiv Classification Dataset: A classification task of Arxiv Papers (11 classes)",
59
  ),
 
 
 
 
 
60
  ]
61
 
62
  DEFAULT_CONFIG_NAME = "arxiv"
@@ -100,4 +104,7 @@ class ArxivClassificationDataset(datasets.GeneratorBasedBuilder):
100
  data = json.loads(row)
101
  label = self._LABELS_DICT[data["label"]]
102
  text = data["text"]
 
 
 
103
  yield id_, {"text": text, "label": label}
 
51
  _LABELS_DICT = {label: i for i, label in enumerate(_LABELS)}
52
 
53
  BUILDER_CONFIGS = [
 
54
  ArxivClassificationConfig(
55
  name="arxiv",
56
  version=datasets.Version("1.0.0"),
57
  description="Arxiv Classification Dataset: A classification task of Arxiv Papers (11 classes)",
58
  ),
59
+ ArxivClassificationConfig(
60
+ name="arxiv-raw",
61
+ version=datasets.Version("1.0.0"),
62
+ description="Arxiv Classification Dataset: A classification task of Arxiv Papers (11 classes)",
63
+ ),
64
  ]
65
 
66
  DEFAULT_CONFIG_NAME = "arxiv"
 
104
  data = json.loads(row)
105
  label = self._LABELS_DICT[data["label"]]
106
  text = data["text"]
107
+ if self.config.name == "arxiv":
108
+ text = text.replace("\n", " ")
109
+ text = re.sub(" +", " ", text)
110
  yield id_, {"text": text, "label": label}