ruanchaves commited on
Commit
955707f
·
1 Parent(s): 38773ef
Files changed (1) hide show
  1. hatebr.py +4 -11
hatebr.py CHANGED
@@ -1,7 +1,7 @@
1
  """HateBR dataset"""
2
 
3
  import datasets
4
- import csv
5
 
6
  _CITATION = """
7
  @inproceedings{vargas2022hatebr,
@@ -46,13 +46,6 @@ class Boun(datasets.GeneratorBasedBuilder):
46
  ]
47
 
48
  def _generate_examples(self, filepath):
49
- with open(filepath, 'r') as file:
50
- my_reader = csv.reader(file, delimiter=',')
51
- for idx, row in enumerate(my_reader):
52
- if idx:
53
- yield idx, {
54
- "instagram_comments": row[0],
55
- "offensive_language": row[1],
56
- "offensiveness_levels": row[2],
57
- "hate_speech": row[3]
58
- }
 
1
  """HateBR dataset"""
2
 
3
  import datasets
4
+ import pandas as pd
5
 
6
  _CITATION = """
7
  @inproceedings{vargas2022hatebr,
 
46
  ]
47
 
48
  def _generate_examples(self, filepath):
49
+ records = pd.read_csv(filepath).to_dict("records")
50
+ for idx, row in enumerate(records):
51
+ yield idx, row