o
    Ni                     @   sj   d Z ddlmZ ddlmZ ddlm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 )(The Definite Pronoun Resolution Dataset.    )absolute_import)division)print_functionNa  @inproceedings{rahman2012resolving,
  title={Resolving complex cases of definite pronouns: the winograd schema challenge},
  author={Rahman, Altaf and Ng, Vincent},
  booktitle={Proceedings of the 2012 Joint Conference on Empirical Methods in Natural Language Processing and Computational Natural Language Learning},
  pages={777--789},
  year={2012},
  organization={Association for Computational Linguistics}
}a  Composed by 30 students from one of the author's undergraduate classes. These
sentence pairs cover topics ranging from real events (e.g., Iran's plan to
attack the Saudi ambassador to the U.S.) to events/characters in movies (e.g.,
Batman) and purely imaginary situations, largely reflecting the pop culture as
perceived by the American kids born in the early 90s. Each annotated example
spans four lines: the first line contains the sentence, the second line contains
the target pronoun, the third line contains the two candidate antecedents, and
the fourth line contains the correct antecedent. If the target pronoun appears
more than once in the sentence, its first occurrence is the one to be resolved.
z8http://www.hlt.utdallas.edu/~vince/data/emnlp12/{}.c.txtc                   @   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 )DefinitePronounResolutionr   
plain_textz1.0.0z6New split API (https://tensorflow.org/datasets/splits)z=Plain text import of the Definite Pronoun Resolution Dataset.)nameversiondescriptionc                 C   sR   t jj| tt jt j t j t jjt j ddt jjdddddt	dS )N   )length)num_classessentencepronoun
candidateslabel)r   r   z0http://www.hlt.utdallas.edu/~vince/data/emnlp12/)builderr
   featuressupervised_keyshomepagecitation)
tfdscoreDatasetInfo_DESCRIPTIONr   FeaturesDictTextSequence
ClassLabel	_CITATION)self r"   h/home/ubuntu/.local/lib/python3.10/site-packages/tensorflow_datasets/text/definite_pronoun_resolution.py_info?   s   
zDefinitePronounResolution._infoc                 C   sT   | tdtdd}tjjtjjd|d idtjjtjjd|d idgS )Ntraintest)r%   r&   filepath)r   
gen_kwargs)	download_DATA_URL_PATTERNformatr   r   SplitGeneratorSplitTESTTRAIN)r!   
dl_managerfilesr"   r"   r#   _split_generatorsR   s   

z+DefinitePronounResolution._split_generatorsc                 c   s    t jj|E}d}	 |d7 }|  }|  }dd |  dD }|  }|  |s7n||||||dfV  qW d    d S 1 sPw   Y  d S )NT   c                 S   s   g | ]}|  qS r"   )strip).0cr"   r"   r#   
<listcomp>g   s    z@DefinitePronounResolution._generate_examples.<locals>.<listcomp>,r   )tfiogfileGFilereadliner5   splitindex)r!   r'   fline_numr   r   r   correctr"   r"   r#   _generate_examples`   s*   
"z,DefinitePronounResolution._generate_examplesN)__name__
__module____qualname____doc__r   r   BuilderConfigVersionBUILDER_CONFIGSr$   r2   rD   r"   r"   r"   r#   r   3   s    
r   )rH   
__future__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   
