lhoestq HF staff commited on
Commit
c727b75
1 Parent(s): 8f82c44

Delete aspect-based-sentiment-analysis-uzbek.py

Browse files
aspect-based-sentiment-analysis-uzbek.py DELETED
@@ -1,51 +0,0 @@
1
- import json
2
- import datasets
3
- from datasets import GeneratorBasedBuilder, DatasetInfo, Split, SplitGenerator, Features, Value, Sequence
4
-
5
- _BASE_URL = "https://drive.google.com/uc?export=download&id=12J5C6knWWPebLsjdZt0zCU4GKzDO5kGa"
6
-
7
-
8
- class UzABSA(GeneratorBasedBuilder):
9
- VERSION = datasets.Version("1.0.0")
10
-
11
- BUILDER_CONFIGS = [
12
- datasets.BuilderConfig(name="uzabsa", version=VERSION,
13
- description="UZABSA dataset for sentiment analysis in Uzbek"),
14
- ]
15
-
16
- def _info(self):
17
- return DatasetInfo(
18
- features=Features({
19
- "sentence_id": Value("string"),
20
- "text": Value("string"),
21
- "aspect_terms": Sequence({
22
- "term": Value("string"),
23
- "polarity": Value("string"),
24
- "from": Value("int32"),
25
- "to": Value("int32"),
26
- }),
27
- "aspect_categories": Sequence({
28
- "category": Value("string"),
29
- "polarity": Value("string"),
30
- }),
31
- })
32
- )
33
-
34
- def _split_generators(self, dl_manager):
35
- # Use the dl_manager to download and cache the data
36
- downloaded_file = dl_manager.download_and_extract(_BASE_URL)
37
- return [
38
- SplitGenerator(name=Split.TRAIN, gen_kwargs={"filepath": downloaded_file}),
39
- ]
40
-
41
- def _generate_examples(self, filepath):
42
- # Now we'll read the jsonl format
43
- with open(filepath, 'r') as file:
44
- for line in file:
45
- record = json.loads(line.strip())
46
- yield record["sentence_id"], {
47
- "sentence_id": record["sentence_id"],
48
- "text": record["text"],
49
- "aspect_terms": record["aspect_terms"],
50
- "aspect_categories": record["aspect_categories"],
51
- }