o
    Ni
                     @   sz   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  m	Z
 ddlmZ dZdZdZG d	d
 d
ejjZdS )zFe-SNLI: Natural Language Inference with Natural Language Explanations.    )absolute_import)division)print_functionNa>  
@incollection{NIPS2018_8163,
title = {e-SNLI: Natural Language Inference with Natural Language Explanations},
author = {Camburu, Oana-Maria and Rockt"{a}schel, Tim and Lukasiewicz, Thomas and Blunsom, Phil},
booktitle = {Advances in Neural Information Processing Systems 31},
editor = {S. Bengio and H. Wallach and H. Larochelle and K. Grauman and N. Cesa-Bianchi and R. Garnett},
pages = {9539--9549},
year = {2018},
publisher = {Curran Associates, Inc.},
url = {http://papers.nips.cc/paper/8163-e-snli-natural-language-inference-with-natural-language-explanations.pdf}
}
z
The e-SNLI dataset extends the Stanford Natural Language Inference Dataset to
include human-annotated natural language explanations of the entailment
relations.
zIhttps://raw.githubusercontent.com/OanaMariaCamburu/e-SNLI/master/dataset/c                   @   sD   e Zd ZdZejjdejdddgZdd Z	dd	 Z
d
d ZdS )EsnlizMe-SNLI: Natural Language Inference with Natural Language Explanations corpus.
plain_textz0.0.2zPlain text import of e-SNLI)nameversiondescriptionc                 C   sZ   t jj| tt jt j t j t jjg ddt j t j t j dd dtdS )N)
entailmentneutralcontradiction)namespremise
hypothesislabelexplanation_1explanation_2explanation_3z*https://github.com/OanaMariaCamburu/e-SNLI)builderr	   featuressupervised_keyshomepagecitation)	tfdscoreDatasetInfo_DESCRIPTIONr   FeaturesDictText
ClassLabel	_CITATION)self r#   R/home/ubuntu/.local/lib/python3.10/site-packages/tensorflow_datasets/text/esnli.py_infoA   s"   zEsnli._infoc                 C   s   | tjtdtjtdgtjtdgtjtdgd}tjjtjj	d|d idtjjtjj
d|d	 idtjjtjjd|d
 idgS )zReturns SplitGenerators.zesnli_train_1.csvzesnli_train_2.csvzesnli_dev.csvzesnli_test.csv)train
validationtestfilesr&   )r   
gen_kwargsr'   r(   )download_and_extractospathjoin_URLr   r   SplitGeneratorSplitTRAIN
VALIDATIONTEST)r"   
dl_managerr)   r#   r#   r$   _split_generatorsY   s(   


zEsnli._split_generatorsc                 c   s    |D ]E}t jj|4}t|}t|D ]"\}}|d |d |d |d |d |dd|ddd	fV  qW d
   n1 sCw   Y  qd
S )zYields examples.pairID	Sentence1	Sentence2
gold_labelExplanation_1Explanation_2 Explanation_3r   N)tfiogfileGFilecsv
DictReader	enumerateget)r"   r)   filepathfreader_rowr#   r#   r$   _generate_examplesr   s"   


zEsnli._generate_examplesN)__name__
__module____qualname____doc__r   r   BuilderConfigVersionBUILDER_CONFIGSr%   r6   rL   r#   r#   r#   r$   r   2   s    
r   )rP   
__future__r   r   r   rC   r,   tensorflow.compat.v2compatv2r?   tensorflow_datasets.public_api
public_apir   r!   r   r/   r   GeneratorBasedBuilderr   r#   r#   r#   r$   <module>   s   