thawani commited on
Commit
b5adada
1 Parent(s): 2cae376

Update WikiConvert.py

Browse files
Files changed (1) hide show
  1. WikiConvert.py +19 -19
WikiConvert.py CHANGED
@@ -48,7 +48,7 @@ Language Modelling with Cardinal Number Annotations.
48
  """
49
 
50
  #_URL = "https://github.com/avi-jit/numeracy-literacy/"
51
- _URL = "https://huggingface.co/datasets/usc-isi/WikiConvert/raw/main/"
52
  _URLS = {
53
  "train": _URL + "train_wiki.json",
54
  "dev": _URL + "dev_wiki.json",
@@ -113,21 +113,21 @@ class WikiConvert(datasets.GeneratorBasedBuilder):
113
  logger.info("generating examples from = %s", filepath)
114
  key = 0
115
  with open(filepath, encoding="utf-8") as f:
116
- #ds = json.load(f)
117
- for row in f:
118
- yield key, {"comment": row[:100], "id": 1, "offset": 2, "length": 3, "magnitude": 4, "number": 5, "UNIQUE_STORY_INDEX": "6"}
119
- key += 1
120
- '''print(row[:100])
121
- ds = json.loads(row)
122
- print(len(ds))
123
- for row in ds:
124
- yield key, {
125
- "id": row["id"],
126
- "UNIQUE_STORY_INDEX": row["UNIQUE_STORY_INDEX"],
127
- "offset": row["offset"],
128
- "length": row["length"],
129
- "magnitude": row["magnitude"],
130
- "comment": row["comment"],
131
- "number": row["number"],
132
- }
133
- key += 1'''
 
48
  """
49
 
50
  #_URL = "https://github.com/avi-jit/numeracy-literacy/"
51
+ _URL = "https://huggingface.co/datasets/usc-isi/WikiConvert/resolve/main/"
52
  _URLS = {
53
  "train": _URL + "train_wiki.json",
54
  "dev": _URL + "dev_wiki.json",
 
113
  logger.info("generating examples from = %s", filepath)
114
  key = 0
115
  with open(filepath, encoding="utf-8") as f:
116
+ ds = json.load(f)
117
+ #for row in f:
118
+ # yield key, {"comment": row[:100], "id": 1, "offset": 2, "length": 3, "magnitude": 4, "number": 5, "UNIQUE_STORY_INDEX": "6"}
119
+ # key += 1
120
+ #print(row[:100])
121
+ #ds = json.loads(row)
122
+ # print(len(ds))
123
+ for row in ds:
124
+ yield key, {
125
+ "id": row["id"],
126
+ "UNIQUE_STORY_INDEX": row["UNIQUE_STORY_INDEX"],
127
+ "offset": row["offset"],
128
+ "length": row["length"],
129
+ "magnitude": row["magnitude"],
130
+ "comment": row["comment"],
131
+ "number": row["number"],
132
+ }
133
+ key += 1