
import csv
import json
import os

import datasets


# TODO: Add BibTeX citation
# Find for instance the citation on arxiv or on the dataset repo/website
lowerCamelCase_				:							str       =    '''\
@InProceedings{huggingface:dataset,
title = {A great new dataset},
author={huggingface, Inc.
},
year={2020}
}
'''

# TODO: Add description of the dataset here
# You can copy an official description
lowerCamelCase_				:							List[str]       =    '''\
This new dataset is designed to solve this great NLP task and is crafted with a lot of care.
'''

# TODO: Add a link to an official homepage for the dataset here
lowerCamelCase_				:							Union[str, Any]       =    ''''''

# TODO: Add the licence for the dataset here if you can find it
lowerCamelCase_				:							Any       =    ''''''

# TODO: Add link to the official dataset URLs here
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
lowerCamelCase_				:							Optional[Any]       =    {
    '''first_domain''': '''https://huggingface.co/great-new-dataset-first_domain.zip''',
    '''second_domain''': '''https://huggingface.co/great-new-dataset-second_domain.zip''',
}







class  _lowerCamelCase			(datasets.GeneratorBasedBuilder					):
     lowercase__				  =			datasets.Version("""1.1.0"""					)

     # This is an example of a dataset with multiple configurations.
     # If you don't want/need to define several sub-sets in your dataset,
     # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.

     # If you need to make complex sub-parts in the datasets with configurable options
     # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
     # BUILDER_CONFIG_CLASS = MyBuilderConfig

     # You will be able to load one or the other configurations in the following list with
     # data = datasets.load_dataset('my_dataset', 'first_domain')
     # data = datasets.load_dataset('my_dataset', 'second_domain')
     lowercase__				  =			[
         datasets.BuilderConfig(name="""first_domain"""							,					version=UpperCamelCase__							,					description="""This part of my dataset covers a first domain"""					),
         datasets.BuilderConfig(name="""second_domain"""							,					version=UpperCamelCase__							,					description="""This part of my dataset covers a second domain"""					),
     ]

     lowercase__				  =			"""first_domain"""  # It's not mandatory to have a default configuration. Just use one if it make sense.

     def 						__lowerCamelCase				(  self    ):
            # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
            if self.config.name == "first_domain":  # This is the name of the configuration selected in BUILDER_CONFIGS above
                   __snake_case						       =   datasets.Features(
                       {
                           'sentence': datasets.Value('string'    ),
                           'option1': datasets.Value('string'    ),
                           'answer': datasets.Value('string'    )
                           # These are the features of your dataset like images, labels ...
                       }    )
            else:  # This is an example to show how to have different features for "first_domain" and "second_domain"
                   __snake_case						       =   datasets.Features(
                       {
                           'sentence': datasets.Value('string'    ),
                           'option2': datasets.Value('string'    ),
                           'second_domain_answer': datasets.Value('string'    )
                           # These are the features of your dataset like images, labels ...
                       }    )
            return datasets.DatasetInfo(
                # This is the description that will appear on the datasets page.
                description=_DESCRIPTION							,       features=SCREAMING_SNAKE_CASE_							,       homepage=_HOMEPAGE							,       license=_LICENSE							,       citation=_CITATION							,       )

     def 						__lowerCamelCase				(  self							,       SCREAMING_SNAKE_CASE_    ):
            # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
            # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name

            # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
            # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
            # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
            __snake_case						       =   _URLS[self.config.name]
            __snake_case						       =   dl_manager.download_and_extract(SCREAMING_SNAKE_CASE_    )
            return [
                datasets.SplitGenerator(
                    name=datasets.Split.TRAIN							,       gen_kwargs={
                        'filepath': os.path.join(SCREAMING_SNAKE_CASE_							,       'train.jsonl'    ),
                        'split': 'train',
                    }							,       ),
                datasets.SplitGenerator(
                    name=datasets.Split.VALIDATION							,       gen_kwargs={
                        'filepath': os.path.join(SCREAMING_SNAKE_CASE_							,       'dev.jsonl'    ),
                        'split': 'dev',
                    }							,       ),
                datasets.SplitGenerator(
                    name=datasets.Split.TEST							,       gen_kwargs={
                        'filepath': os.path.join(SCREAMING_SNAKE_CASE_							,       'test.jsonl'    ),
                        'split': 'test'
                    }							,       ),
            ]

     def 						__lowerCamelCase				(  self							,       SCREAMING_SNAKE_CASE_							,       SCREAMING_SNAKE_CASE_    ):
            # TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
            # The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
            with open(SCREAMING_SNAKE_CASE_							,       encoding='utf-8'    ) as f:
                   for key, row in enumerate(SCREAMING_SNAKE_CASE_    ):
                          __snake_case						       =   json.loads(SCREAMING_SNAKE_CASE_    )
                          if self.config.name == "first_domain":
                                 # Yields examples as (key, example) tuples
                                 yield key, {
                                     "sentence": data["sentence"],
                                     "option1": data["option1"],
                                     "answer": "" if split == "test" else data["answer"],
                                 }
                          else:
                                 yield key, {
                                     "sentence": data["sentence"],
                                     "option2": data["option2"],
                                     "second_domain_answer": "" if split == "test" else data["second_domain_answer"],
                                 }





'''simple docstring'''



from sklearn.metrics import accuracy_score

import datasets


lowerCAmelCase						:		Optional[Any]						      = '''
Accuracy is the proportion of correct predictions among the total number of cases processed. It can be computed with:
Accuracy = (TP + TN) / (TP + TN + FP + FN)
 Where:
TP: True positive
TN: True negative
FP: False positive
FN: False negative
'''


lowerCAmelCase						:		str						      = '''
Args:
    predictions (`list` of `int`): Predicted labels.
    references (`list` of `int`): Ground truth labels.
    normalize (`boolean`): If set to False, returns the number of correctly classified samples. Otherwise, returns the fraction of correctly classified samples. Defaults to True.
    sample_weight (`list` of `float`): Sample weights Defaults to None.

Returns:
    accuracy (`float` or `int`): Accuracy score. Minimum possible value is 0. Maximum possible value is 1.0, or the number of examples input, if `normalize` is set to `True`.. A higher score means higher accuracy.

Examples:

    Example 1-A simple example
        >>> accuracy_metric = datasets.load_metric("accuracy")
        >>> results = accuracy_metric.compute(references=[0, 1, 2, 0, 1, 2], predictions=[0, 1, 1, 2, 1, 0])
        >>> print(results)
        {\'accuracy\': 0.5}

    Example 2-The same as Example 1, except with `normalize` set to `False`.
        >>> accuracy_metric = datasets.load_metric("accuracy")
        >>> results = accuracy_metric.compute(references=[0, 1, 2, 0, 1, 2], predictions=[0, 1, 1, 2, 1, 0], normalize=False)
        >>> print(results)
        {\'accuracy\': 3.0}

    Example 3-The same as Example 1, except with `sample_weight` set.
        >>> accuracy_metric = datasets.load_metric("accuracy")
        >>> results = accuracy_metric.compute(references=[0, 1, 2, 0, 1, 2], predictions=[0, 1, 1, 2, 1, 0], sample_weight=[0.5, 2, 0.7, 0.5, 9, 0.4])
        >>> print(results)
        {\'accuracy\': 0.8778625954198473}
'''


lowerCAmelCase						:		int						      = '''
@article{scikit-learn,
  title={Scikit-learn: Machine Learning in {P}ython},
  author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.
         and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofer, P.
         and Weiss, R. and Dubourg, V. and Vanderplas, J. and Passos, A. and
         Cournapeau, D. and Brucher, M. and Perrot, M. and Duchesnay, E.},
  journal={Journal of Machine Learning Research},
  volume={12},
  pages={2825--2830},
  year={2011}
}
'''






@datasets.utils.file_utils.add_start_docstrings(_DESCRIPTION				,							_KWARGS_DESCRIPTION			)
class        UpperCAmelCase__						(		datasets.Metric			):



					def 							UpperCAmelCase_			(     self  )  ->      Optional[Any]:
						return datasets.MetricInfo(
						    description=_DESCRIPTION      ,					citation=_CITATION      ,					inputs_description=_KWARGS_DESCRIPTION      ,					features=datasets.Features(
						        {
						            "predictions": datasets.Sequence(datasets.Value("int32"  )  ),
						            "references": datasets.Sequence(datasets.Value("int32"  )  ),
						        }
						        if self.config_name == "multilabel"
						        else {
						            "predictions": datasets.Value("int32"  ),
						            "references": datasets.Value("int32"  ),
						        }  )      ,					reference_urls=["https://scikit-learn.org/stable/modules/generated/sklearn.metrics.accuracy_score.html"]      ,					)



					def 							UpperCAmelCase_			(     self      ,					UpperCamelCase      ,					UpperCamelCase      ,					UpperCamelCase=True      ,					UpperCamelCase=None  )  ->      List[str]:
						return {
						    "accuracy": float(
						        accuracy_score(UpperCamelCase      ,					UpperCamelCase      ,					normalize=UpperCamelCase      ,					sample_weight=UpperCamelCase  )  )
						}