phusroyal commited on
Commit
8681eb8
1 Parent(s): c9abf2e

Update ViHOS.py

Browse files
Files changed (1) hide show
  1. ViHOS.py +9 -25
ViHOS.py CHANGED
@@ -47,37 +47,21 @@ class ViHOS(datasets.GeneratorBasedBuilder):
47
  "split": "test",
48
  },
49
  )
50
- ]
51
- def load_csv(filename):
52
- data = list()
53
- # Open file in read mode
54
- file = open(filename,"r")
55
- # Reading file
56
- lines = reader(file)
57
- csv_reader = reader(file)
58
- for row in csv_reader:
59
- if not row:
60
- continue
61
- data.append(row)
62
-
63
- return data
64
-
65
  def _generate_examples(self, filepath, split):
66
  colnames=['id', 'Content', 'Span ids']
67
 
68
  data = pd.read_csv(filepath, names=colnames, header=None, sep=",", on_bad_lines='skip')
69
 
70
- # for i in range(len(data)):
71
- # id_ = data.loc[i, 'id']
72
- # content = data.loc[i, 'Content']
73
- # span_ids = data.loc[i, 'Span ids']
74
 
75
- # yield id_, {
76
- # "id": id_,
77
- # "content": content,
78
- # "span_ids": span_ids,
79
- # }
80
- yield data
81
 
82
  # data = pd.read_csv(filepath, colnames=colnames, header = None)
83
  # yield data.iloc[:, 0], dataframe.iloc[:, 1], dataframe.iloc[:, 2]
 
47
  "split": "test",
48
  },
49
  )
50
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  def _generate_examples(self, filepath, split):
52
  colnames=['id', 'Content', 'Span ids']
53
 
54
  data = pd.read_csv(filepath, names=colnames, header=None, sep=",", on_bad_lines='skip')
55
 
56
+ for i in range(len(data)):
57
+ id_ = data.loc[i, 'id']
58
+ content = data.loc[i, 'Content']
59
+ span_ids = data.loc[i, 'Span ids']
60
 
61
+ yield id_, {
62
+ "content": content,
63
+ "span_ids": span_ids,
64
+ }
 
 
65
 
66
  # data = pd.read_csv(filepath, colnames=colnames, header = None)
67
  # yield data.iloc[:, 0], dataframe.iloc[:, 1], dataframe.iloc[:, 2]