o
    Ni                     @   sn   d Z ddlmZ ddlmZ ddlmZ ddlZddlZddlm	Z
 dZdZdd	d
ZG dd de
jjZdS )zThe MC Taco dataset.    )absolute_import)division)print_functionNa  @inproceedings{ZKNR19,
    author = {Ben Zhou, Daniel Khashabi, Qiang Ning and Dan Roth},
    title = {"Going on a vacation" takes longer than "Going for a walk": A Study of Temporal Commonsense Understanding },
    booktitle = {EMNLP},
    year = {2019},
}
a  MC-TACO is a dataset of 13k question-answer pairs that require temporal
commonsense comprehension. The dataset contains five temporal properties:

1. duration (how long an event takes)
2. temporal ordering (typical order of events)
3. typical time (when an event occurs)
4. frequency (how often an event occurs)
5. stationarity (whether a state is maintained for a very long time or indefinitely)

We hope that this dataset can promote the future exploration of this
 particular class of reasoning problems.
zLhttps://raw.githubusercontent.com/CogComp/MCTACO/master/dataset/dev_3783.tsvzMhttps://raw.githubusercontent.com/CogComp/MCTACO/master/dataset/test_9442.tsv)
validationtestc                   @   s4   e Zd ZdZejdZdd Zdd Z	dd Z
d	S )
MctacozThe Mctaco dataset.z1.0.0c                 C   sZ   t jj| tt jt j t j t j t jjddgdt jjg dddd dtdS )Nnoyes)names)zEvent OrderingzEvent Duration	FrequencyStationarityzTypical Timesentencequestionanswerlabelcategoryz!https://github.com/CogComp/MCTACO)builderdescriptionfeaturessupervised_keyshomepagecitation)	tfdscoreDatasetInfo_DESCRIPTIONr   FeaturesDictText
ClassLabel	_CITATION)self r"   a/home/ubuntu/.local/lib/python3.10/site-packages/tensorflow_datasets/question_answering/mctaco.py_info?   s   zMctaco._infoc                 C   s   | t}dd | D S )zReturns SplitGenerators.c                 S   s$   g | ]\}}t jj|d |idqS )	file_path)name
gen_kwargs)r   r   SplitGenerator).0splitr%   r"   r"   r#   
<listcomp>]   s    z,Mctaco._split_generators.<locals>.<listcomp>)download_SPLIT_DOWNLOAD_URLitems)r!   
dl_manager
file_pathsr"   r"   r#   _split_generatorsY   s   
zMctaco._split_generatorsc              	   c   s    t jj|1}tj|dg dd}t|D ]\}}||d |d |d |d |d dfV  qW d	   d	S 1 s<w   Y  d	S )
z:This function returns the examples in the raw (text) form.	r   )	delimiter
fieldnamesr   r   r   r   r   N)tfiogfileGFilecsv
DictReader	enumerate)r!   r%   freaderirowr"   r"   r#   _generate_examplesc   s"   "zMctaco._generate_examplesN)__name__
__module____qualname____doc__r   r   VersionVERSIONr$   r1   r@   r"   r"   r"   r#   r   :   s    
r   )rD   
__future__r   r   r   r9   
tensorflowr5   tensorflow_datasets.public_api
public_apir   r    r   r-   r   GeneratorBasedBuilderr   r"   r"   r"   r#   <module>   s   	