Convert dataset to Parquet (#1)
Browse files- Convert dataset to Parquet (cb5c4c388f3189f0323d654164c02e7dfbb3ef11)
- Delete loading script (b4995fcbc73cdc62d746d6c9896cc04b5366a172)
Co-authored-by: Nathan Habib <[email protected]>
- README.md +26 -1
- asdiv.py +0 -111
- asdiv/validation-00000-of-00001.parquet +3 -0
    	
        README.md
    CHANGED
    
    | @@ -1,3 +1,28 @@ | |
| 1 | 
             
            ---
         | 
| 2 | 
             
            license: cc-by-nc-4.0
         | 
| 3 | 
            -
             | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
             
            ---
         | 
| 2 | 
             
            license: cc-by-nc-4.0
         | 
| 3 | 
            +
            dataset_info:
         | 
| 4 | 
            +
              config_name: asdiv
         | 
| 5 | 
            +
              features:
         | 
| 6 | 
            +
              - name: body
         | 
| 7 | 
            +
                dtype: string
         | 
| 8 | 
            +
              - name: question
         | 
| 9 | 
            +
                dtype: string
         | 
| 10 | 
            +
              - name: solution_type
         | 
| 11 | 
            +
                dtype: string
         | 
| 12 | 
            +
              - name: answer
         | 
| 13 | 
            +
                dtype: string
         | 
| 14 | 
            +
              - name: formula
         | 
| 15 | 
            +
                dtype: string
         | 
| 16 | 
            +
              splits:
         | 
| 17 | 
            +
              - name: validation
         | 
| 18 | 
            +
                num_bytes: 501489
         | 
| 19 | 
            +
                num_examples: 2305
         | 
| 20 | 
            +
              download_size: 266768
         | 
| 21 | 
            +
              dataset_size: 501489
         | 
| 22 | 
            +
            configs:
         | 
| 23 | 
            +
            - config_name: asdiv
         | 
| 24 | 
            +
              data_files:
         | 
| 25 | 
            +
              - split: validation
         | 
| 26 | 
            +
                path: asdiv/validation-*
         | 
| 27 | 
            +
              default: true
         | 
| 28 | 
            +
            ---
         | 
    	
        asdiv.py
    DELETED
    
    | @@ -1,111 +0,0 @@ | |
| 1 | 
            -
            # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
         | 
| 2 | 
            -
            #
         | 
| 3 | 
            -
            # Licensed under the Apache License, Version 2.0 (the "License");
         | 
| 4 | 
            -
            # you may not use this file except in compliance with the License.
         | 
| 5 | 
            -
            # You may obtain a copy of the License at
         | 
| 6 | 
            -
            #
         | 
| 7 | 
            -
            #     http://www.apache.org/licenses/LICENSE-2.0
         | 
| 8 | 
            -
            #
         | 
| 9 | 
            -
            # Unless required by applicable law or agreed to in writing, software
         | 
| 10 | 
            -
            # distributed under the License is distributed on an "AS IS" BASIS,
         | 
| 11 | 
            -
            # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         | 
| 12 | 
            -
            # See the License for the specific language governing permissions and
         | 
| 13 | 
            -
            # limitations under the License.
         | 
| 14 | 
            -
            """ASDIV dataset."""
         | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
            import os
         | 
| 18 | 
            -
            import xml.etree.ElementTree as ET
         | 
| 19 | 
            -
             | 
| 20 | 
            -
            import datasets
         | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
            _CITATION = """\
         | 
| 24 | 
            -
            @misc{miao2021diverse,
         | 
| 25 | 
            -
                title={A Diverse Corpus for Evaluating and Developing English Math Word Problem Solvers},
         | 
| 26 | 
            -
                author={Shen-Yun Miao and Chao-Chun Liang and Keh-Yih Su},
         | 
| 27 | 
            -
                year={2021},
         | 
| 28 | 
            -
                eprint={2106.15772},
         | 
| 29 | 
            -
                archivePrefix={arXiv},
         | 
| 30 | 
            -
                primaryClass={cs.AI}
         | 
| 31 | 
            -
            }
         | 
| 32 | 
            -
            """
         | 
| 33 | 
            -
             | 
| 34 | 
            -
            _DESCRIPTION = """\
         | 
| 35 | 
            -
            ASDiv (Academia Sinica Diverse MWP Dataset) is a diverse (in terms of both language
         | 
| 36 | 
            -
            patterns and problem types) English math word problem (MWP) corpus for evaluating
         | 
| 37 | 
            -
            the capability of various MWP solvers. Existing MWP corpora for studying AI progress
         | 
| 38 | 
            -
            remain limited either in language usage patterns or in problem types. We thus present
         | 
| 39 | 
            -
            a new English MWP corpus with 2,305 MWPs that cover more text patterns and most problem
         | 
| 40 | 
            -
            types taught in elementary school. Each MWP is annotated with its problem type and grade
         | 
| 41 | 
            -
            level (for indicating the level of difficulty).
         | 
| 42 | 
            -
            """
         | 
| 43 | 
            -
             | 
| 44 | 
            -
            _HOMEPAGE = "https://github.com/chaochun/nlu-asdiv-dataset"
         | 
| 45 | 
            -
             | 
| 46 | 
            -
            # License declared at https://github.com/chaochun/nlu-asdiv-dataset/blob/master/README.md
         | 
| 47 | 
            -
            _LICENSE = "CC BY-NC 4.0"
         | 
| 48 | 
            -
             | 
| 49 | 
            -
            _URLS = "https://github.com/chaochun/nlu-asdiv-dataset/archive/55790e5270bb91ccfa5053194b25732534696b50.zip"
         | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
            class ASDiv(datasets.GeneratorBasedBuilder):
         | 
| 53 | 
            -
                """ASDiv: A Diverse Corpus for Evaluating and Developing English Math Word Problem Solvers"""
         | 
| 54 | 
            -
             | 
| 55 | 
            -
                VERSION = datasets.Version("0.0.1")
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                BUILDER_CONFIGS = [
         | 
| 58 | 
            -
                    datasets.BuilderConfig(
         | 
| 59 | 
            -
                        name="asdiv",
         | 
| 60 | 
            -
                        version=VERSION,
         | 
| 61 | 
            -
                        description="A diverse corpus for evaluating and developing english math word problem solvers",
         | 
| 62 | 
            -
                    )
         | 
| 63 | 
            -
                ]
         | 
| 64 | 
            -
             | 
| 65 | 
            -
                def _info(self):
         | 
| 66 | 
            -
                    features = datasets.Features(
         | 
| 67 | 
            -
                        {
         | 
| 68 | 
            -
                            "body": datasets.Value("string"),
         | 
| 69 | 
            -
                            "question": datasets.Value("string"),
         | 
| 70 | 
            -
                            "solution_type": datasets.Value("string"),
         | 
| 71 | 
            -
                            "answer": datasets.Value("string"),
         | 
| 72 | 
            -
                            "formula": datasets.Value("string"),
         | 
| 73 | 
            -
                        }
         | 
| 74 | 
            -
                    )
         | 
| 75 | 
            -
                    return datasets.DatasetInfo(
         | 
| 76 | 
            -
                        description=_DESCRIPTION,
         | 
| 77 | 
            -
                        features=features,
         | 
| 78 | 
            -
                        homepage=_HOMEPAGE,
         | 
| 79 | 
            -
                        license=_LICENSE,
         | 
| 80 | 
            -
                        citation=_CITATION,
         | 
| 81 | 
            -
                    )
         | 
| 82 | 
            -
             | 
| 83 | 
            -
                def _split_generators(self, dl_manager):
         | 
| 84 | 
            -
                    urls = _URLS
         | 
| 85 | 
            -
                    data_dir = dl_manager.download_and_extract(urls)
         | 
| 86 | 
            -
                    base_filepath = "nlu-asdiv-dataset-55790e5270bb91ccfa5053194b25732534696b50"
         | 
| 87 | 
            -
                    return [
         | 
| 88 | 
            -
                        datasets.SplitGenerator(
         | 
| 89 | 
            -
                            name=datasets.Split.VALIDATION,
         | 
| 90 | 
            -
                            # These kwargs will be passed to _generate_examples
         | 
| 91 | 
            -
                            gen_kwargs={
         | 
| 92 | 
            -
                                "filepath": os.path.join(
         | 
| 93 | 
            -
                                    data_dir, base_filepath, "dataset", "ASDiv.xml"
         | 
| 94 | 
            -
                                ),
         | 
| 95 | 
            -
                                "split": datasets.Split.VALIDATION,
         | 
| 96 | 
            -
                            },
         | 
| 97 | 
            -
                        ),
         | 
| 98 | 
            -
                    ]
         | 
| 99 | 
            -
             | 
| 100 | 
            -
                # method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
         | 
| 101 | 
            -
                def _generate_examples(self, filepath, split):
         | 
| 102 | 
            -
                    tree = ET.parse(filepath)
         | 
| 103 | 
            -
                    root = tree.getroot()
         | 
| 104 | 
            -
                    for key, problem in enumerate(root.iter("Problem")):
         | 
| 105 | 
            -
                        yield key, {
         | 
| 106 | 
            -
                            "body": problem.find("Body").text,
         | 
| 107 | 
            -
                            "question": problem.find("Question").text,
         | 
| 108 | 
            -
                            "solution_type": problem.find("Solution-Type").text,
         | 
| 109 | 
            -
                            "answer": problem.find("Answer").text,
         | 
| 110 | 
            -
                            "formula": problem.find("Formula").text,
         | 
| 111 | 
            -
                        }
         | 
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
    	
        asdiv/validation-00000-of-00001.parquet
    ADDED
    
    | @@ -0,0 +1,3 @@ | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            version https://git-lfs.github.com/spec/v1
         | 
| 2 | 
            +
            oid sha256:79dbad6536fe3e8cd449e67da859d7a6f5ac0d8f852efe563742ca5faee7fb75
         | 
| 3 | 
            +
            size 266768
         | 

 
		