Delete bias_lexicon.py
Browse files- bias_lexicon.py +0 -37
bias_lexicon.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
| 1 |
-
from __future__ import absolute_import, division, print_function
|
| 2 |
-
|
| 3 |
-
import datasets
|
| 4 |
-
import os
|
| 5 |
-
import pandas as pd
|
| 6 |
-
from ast import literal_eval
|
| 7 |
-
|
| 8 |
-
_DESCRIPTION = "bias lexicon"
|
| 9 |
-
_URL = "lexicon.csv"
|
| 10 |
-
_HOMEPAGE = ""
|
| 11 |
-
_LICENSE = ""
|
| 12 |
-
|
| 13 |
-
class LEXI(datasets.GeneratorBasedBuilder):
|
| 14 |
-
|
| 15 |
-
def _info(self):
|
| 16 |
-
return datasets.DatasetInfo(
|
| 17 |
-
description=_DESCRIPTION,
|
| 18 |
-
features=datasets.Features(
|
| 19 |
-
{"biased_words":datasets.Value("string")}
|
| 20 |
-
)
|
| 21 |
-
)
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
def _split_generators(self, dl_manager):
|
| 26 |
-
path = dl_manager.download_and_extract(_URL)
|
| 27 |
-
|
| 28 |
-
# There is no predefined train/val/test split for this dataset.
|
| 29 |
-
return [
|
| 30 |
-
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"file_path": path}),
|
| 31 |
-
]
|
| 32 |
-
|
| 33 |
-
def _generate_examples(self, file_path):
|
| 34 |
-
df = pd.read_csv(file_path,names=['biased_words'])
|
| 35 |
-
|
| 36 |
-
for i, row in df.iterrows():
|
| 37 |
-
yield i, {"text":row['biased_words']}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|