albertvillanova HF staff commited on
Commit
56ded24
1 Parent(s): 489fda2

Delete loading script

Browse files
Files changed (1) hide show
  1. allocine.py +0 -106
allocine.py DELETED
@@ -1,106 +0,0 @@
1
- """Allocine Dataset: A Large-Scale French Movie Reviews Dataset."""
2
-
3
-
4
- import json
5
-
6
- import datasets
7
- from datasets.tasks import TextClassification
8
-
9
-
10
- _CITATION = """\
11
- @misc{blard2019allocine,
12
- author = {Blard, Theophile},
13
- title = {french-sentiment-analysis-with-bert},
14
- year = {2020},
15
- publisher = {GitHub},
16
- journal = {GitHub repository},
17
- howpublished={\\url{https://github.com/TheophileBlard/french-sentiment-analysis-with-bert}},
18
- }
19
- """
20
-
21
- _DESCRIPTION = """\
22
- Allocine Dataset: A Large-Scale French Movie Reviews Dataset.
23
- This is a dataset for binary sentiment classification, made of user reviews scraped from Allocine.fr.
24
- It contains 100k positive and 100k negative reviews divided into 3 balanced splits: train (160k reviews), val (20k) and test (20k).
25
- """
26
-
27
-
28
- class AllocineConfig(datasets.BuilderConfig):
29
- """BuilderConfig for Allocine."""
30
-
31
- def __init__(self, **kwargs):
32
- """BuilderConfig for Allocine.
33
-
34
- Args:
35
- **kwargs: keyword arguments forwarded to super.
36
- """
37
- super(AllocineConfig, self).__init__(**kwargs)
38
-
39
-
40
- class AllocineDataset(datasets.GeneratorBasedBuilder):
41
- """Allocine Dataset: A Large-Scale French Movie Reviews Dataset."""
42
-
43
- _DOWNLOAD_URL = "https://github.com/TheophileBlard/french-sentiment-analysis-with-bert/raw/master/allocine_dataset/data.tar.bz2"
44
- _TRAIN_FILE = "train.jsonl"
45
- _VAL_FILE = "val.jsonl"
46
- _TEST_FILE = "test.jsonl"
47
-
48
- BUILDER_CONFIGS = [
49
- AllocineConfig(
50
- name="allocine",
51
- version=datasets.Version("1.0.0"),
52
- description="Allocine Dataset: A Large-Scale French Movie Reviews Dataset",
53
- ),
54
- ]
55
-
56
- def _info(self):
57
- return datasets.DatasetInfo(
58
- description=_DESCRIPTION,
59
- features=datasets.Features(
60
- {
61
- "review": datasets.Value("string"),
62
- "label": datasets.features.ClassLabel(names=["neg", "pos"]),
63
- }
64
- ),
65
- supervised_keys=None,
66
- homepage="https://github.com/TheophileBlard/french-sentiment-analysis-with-bert",
67
- citation=_CITATION,
68
- task_templates=[TextClassification(text_column="review", label_column="label")],
69
- )
70
-
71
- def _split_generators(self, dl_manager):
72
- archive_path = dl_manager.download(self._DOWNLOAD_URL)
73
- data_dir = "data"
74
- return [
75
- datasets.SplitGenerator(
76
- name=datasets.Split.TRAIN,
77
- gen_kwargs={
78
- "filepath": f"{data_dir}/{self._TRAIN_FILE}",
79
- "files": dl_manager.iter_archive(archive_path),
80
- },
81
- ),
82
- datasets.SplitGenerator(
83
- name=datasets.Split.VALIDATION,
84
- gen_kwargs={
85
- "filepath": f"{data_dir}/{self._VAL_FILE}",
86
- "files": dl_manager.iter_archive(archive_path),
87
- },
88
- ),
89
- datasets.SplitGenerator(
90
- name=datasets.Split.TEST,
91
- gen_kwargs={
92
- "filepath": f"{data_dir}/{self._TEST_FILE}",
93
- "files": dl_manager.iter_archive(archive_path),
94
- },
95
- ),
96
- ]
97
-
98
- def _generate_examples(self, filepath, files):
99
- """Generate Allocine examples."""
100
- for path, file in files:
101
- if path == filepath:
102
- for id_, row in enumerate(file):
103
- data = json.loads(row.decode("utf-8"))
104
- review = data["review"]
105
- label = "neg" if data["polarity"] == 0 else "pos"
106
- yield id_, {"review": review, "label": label}