Datasets:

Modalities:
Text
Formats:
parquet
ArXiv:
License:
sileod commited on
Commit
d07946d
·
verified ·
1 Parent(s): 589bd9e

Remove legacy loading script

Browse files
Files changed (1) hide show
  1. mtop.py +0 -100
mtop.py DELETED
@@ -1,100 +0,0 @@
1
- import datasets
2
-
3
- """
4
- domain in {'alarm',
5
- 'calling',
6
- 'event',
7
- 'messaging',
8
- 'music',
9
- 'news',
10
- 'people',
11
- 'recipes',
12
- 'reminder',
13
- 'timer',
14
- 'weather'}
15
- """
16
-
17
- _URL = "https://fb.me/mtop_dataset"
18
-
19
- _CITATION = """@article{li2020mtop,
20
- title={MTOP: A comprehensive multilingual task-oriented semantic parsing benchmark},
21
- author={Li, Haoran and Arora, Abhinav and Chen, Shuohui and Gupta, Anchit and Gupta, Sonal and Mehdad, Yashar},
22
- journal={arXiv preprint arXiv:2008.09335},
23
- year={2020}
24
- }"""
25
-
26
- _DESCRIPTION = """ """
27
-
28
-
29
-
30
- class MtopConfig(datasets.BuilderConfig):
31
- """BuilderConfig for Mtop."""
32
-
33
- def __init__(self, **kwargs):
34
- """BuilderConfig for Mtop.
35
-
36
- Args:
37
- **kwargs: keyword arguments forwarded to super.
38
- """
39
- super(MtopConfig, self).__init__(**kwargs)
40
-
41
-
42
- class Mtop(datasets.GeneratorBasedBuilder):
43
-
44
- BUILDER_CONFIGS = [
45
- MtopConfig(
46
- name="mtop",
47
- version=datasets.Version("1.0.0", ""),
48
- description="Plain text",
49
- ),
50
- ]
51
-
52
- def _info(self):
53
- return datasets.DatasetInfo(
54
- description=_DESCRIPTION,
55
- features=datasets.Features(
56
- {
57
- "idx": datasets.Value("string"),
58
- "intent": datasets.Value("string"),
59
- "spans": datasets.Value("string"),
60
- "question": datasets.Value("string"),
61
- "domain": datasets.Value("string"),
62
- "lang": datasets.Value("string"),
63
- "logical_form": datasets.Value("string"),
64
- "tokenized_question": datasets.Value("string"),
65
- }
66
- ),
67
- # No default supervised_keys (as we have to pass both question
68
- # and context as input).
69
- supervised_keys=None,
70
- homepage="",
71
- citation=_CITATION,
72
-
73
- )
74
-
75
- def _split_generators(self, dl_manager):
76
- filepath = dl_manager.download_and_extract(_URL)
77
-
78
- return [
79
- datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": filepath,"split":"train"}),
80
- datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": filepath,"split":"eval"}),
81
- datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": filepath,"split":"test"}),
82
- ]
83
-
84
- def _generate_examples(self, filepath, split):
85
- """This function returns the examples in the raw (text) form."""
86
- key = 0
87
- for lang in "de en es fr hi th".split():
88
- with open(f"{filepath}/mtop/{lang}/{split}.txt", encoding="utf-8") as f:
89
- for example in f:
90
- example = example.split("\t")
91
- dict_example = dict(idx=example[0],
92
- intent=example[1],
93
- spans=example[2],
94
- question=example[3],
95
- domain=example[4],
96
- lang=example[5],
97
- logical_form=example[6],
98
- tokenized_question=example[7])
99
- yield key, dict_example
100
- key += 1