U
    ,È-eT  ã                   @   s`   d Z ddlmZmZmZ ddlmZ ddlmZm	Z	m
Z
mZmZ ddlmZ G dd„ deƒZd	S )
z
Processor class for Bros.
é    )ÚListÚOptionalÚUnioné   )ÚProcessorMixin)ÚBatchEncodingÚPaddingStrategyÚPreTokenizedInputÚ	TextInputÚTruncationStrategy)Ú
TensorTypec                       sº   e Zd ZdZdgZdZd‡ fdd„	Zdeee	e
e e
e	 f eeeeef eeeef ee eee ee ee eeeeeeeeef  ed
œdd„Zdd„ Zdd„ Zedd„ ƒZ‡  ZS )ÚBrosProcessora…  
    Constructs a Bros processor which wraps a BERT tokenizer.

    [`BrosProcessor`] offers all the functionalities of [`BertTokenizerFast`]. See the docstring of
    [`~BrosProcessor.__call__`] and [`~BrosProcessor.decode`] for more information.

    Args:
        tokenizer (`BertTokenizerFast`):
            An instance of ['BertTokenizerFast`]. The tokenizer is a required input.
    Ú	tokenizer)ZBertTokenizerZBertTokenizerFastNc                    s    |d krt dƒ‚tƒ  |¡ d S )Nz"You need to specify a `tokenizer`.)Ú
ValueErrorÚsuperÚ__init__)Úselfr   Úkwargs©Ú	__class__© úi/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/transformers/models/bros/processing_bros.pyr   (   s    zBrosProcessor.__init__TFr   )ÚtextÚadd_special_tokensÚpaddingÚ
truncationÚ
max_lengthÚstrideÚpad_to_multiple_ofÚreturn_token_type_idsÚreturn_attention_maskÚreturn_overflowing_tokensÚreturn_special_tokens_maskÚreturn_offsets_mappingÚreturn_lengthÚverboseÚreturn_tensorsÚreturnc                 K   s4   | j f |||||||||	|
|||||dœ|—Ž}|S )z¶
        This method uses [`BertTokenizerFast.__call__`] to prepare text for the model.

        Please refer to the docstring of the above two methods for more information.
        )r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   )r   )r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r   Úencodingr   r   r   Ú__call__.   s(    ñðzBrosProcessor.__call__c                 O   s   | j j||ŽS )zÁ
        This method forwards all its arguments to BertTokenizerFast's [`~PreTrainedTokenizer.batch_decode`]. Please
        refer to the docstring of this method for more information.
        )r   Úbatch_decode©r   Úargsr   r   r   r   r*   [   s    zBrosProcessor.batch_decodec                 O   s   | j j||ŽS )z»
        This method forwards all its arguments to BertTokenizerFast's [`~PreTrainedTokenizer.decode`]. Please refer to
        the docstring of this method for more information.
        )r   Údecoder+   r   r   r   r-   b   s    zBrosProcessor.decodec                 C   s   | j j}tt |¡ƒS )N)r   Úmodel_input_namesÚlistÚdictÚfromkeys)r   Ztokenizer_input_namesr   r   r   r.   i   s    zBrosProcessor.model_input_names)N)NTFNNr   NNNFFFFTN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
attributesZtokenizer_classr   r   r
   r	   r   ÚboolÚstrr   r   r   Úintr   r   r)   r*   r-   Úpropertyr.   Ú__classcell__r   r   r   r   r      sR   
               ðî-r   N)r5   Útypingr   r   r   Zprocessing_utilsr   Ztokenization_utils_baser   r   r	   r
   r   Úutilsr   r   r   r   r   r   Ú<module>   s
   