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 )6The Stanford Natural Language Inference (SNLI) Corpus.    )absolute_import)division)print_functionNa  @inproceedings{snli:emnlp2015,
	Author = {Bowman, Samuel R. and Angeli, Gabor and Potts, Christopher, and Manning, Christopher D.},
	Booktitle = {Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (EMNLP)},
	Publisher = {Association for Computational Linguistics},
	Title = {A large annotated corpus for learning natural language inference},
	Year = {2015}
}
a-  The SNLI corpus (version 1.0) is a collection of 570k human-written English
sentence pairs manually labeled for balanced classification with the labels
entailment, contradiction, and neutral, supporting the task of natural language
inference (NLI), also known as recognizing textual entailment (RTE).
z3https://nlp.stanford.edu/projects/snli/snli_1.0.zipc                   @   sF   e Zd ZdZejjdejddddgZdd Z	d	d
 Z
dd ZdS )Snlir   
plain_textz1.0.0z6New split API (https://tensorflow.org/datasets/splits)zPlain text import of SNLI)nameversiondescriptionc              
   C   sB   t jj| tt jt j t j t jjg dddd dtdS )N)
entailmentneutralcontradiction)namespremise
hypothesislabelz'https://nlp.stanford.edu/projects/snli/)builderr
   featuressupervised_keyshomepagecitation)	tfdscoreDatasetInfo_DESCRIPTIONr   FeaturesDictText
ClassLabel	_CITATION)self r!   Q/home/ubuntu/.local/lib/python3.10/site-packages/tensorflow_datasets/text/snli.py_info=   s   z
Snli._infoc              	   C   s|   | t}tj|d}tjjtjj	dtj|didtjjtjj
dtj|didtjjtjjdtj|didgS )Nzsnli_1.0filepathzsnli_1.0_test.txt)r   
gen_kwargszsnli_1.0_dev.txtzsnli_1.0_train.txt)download_and_extract	_DATA_URLospathjoinr   r   SplitGeneratorSplitTEST
VALIDATIONTRAIN)r    
dl_managerdl_dirdata_dirr!   r!   r"   _split_generatorsQ   s&   

zSnli._split_generatorsc                 c   s    t jj|4}tj|dtjd}t|D ]\}}|d dkr"dn|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.	)	delimiterquoting
gold_label-	sentence1	sentence2r   N)tfiogfileGFilecsv
DictReader
QUOTE_NONE	enumerate)r    r$   freaderidxrowr   r!   r!   r"   _generate_examplese   s   "zSnli._generate_examplesN)__name__
__module____qualname____doc__r   r   BuilderConfigVersionBUILDER_CONFIGSr#   r3   rH   r!   r!   r!   r"   r   1   s    
r   )rL   
__future__r   r   r   r@   r(   tensorflow.compat.v2compatv2r<   tensorflow_datasets.public_api
public_apir   r   r   r'   r   GeneratorBasedBuilderr   r!   r!   r!   r"   <module>   s   
