





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_electra import ElectraTokenizer


_UpperCamelCase				=       {"vocab_file": "vocab.txt", "tokenizer_file": "tokenizer.json"}

_UpperCamelCase				=       {
    "vocab_file": {
        "google/electra-small-generator": (
            "https://huggingface.co/google/electra-small-generator/resolve/main/vocab.txt"
        ),
        "google/electra-base-generator": "https://huggingface.co/google/electra-base-generator/resolve/main/vocab.txt",
        "google/electra-large-generator": (
            "https://huggingface.co/google/electra-large-generator/resolve/main/vocab.txt"
        ),
        "google/electra-small-discriminator": (
            "https://huggingface.co/google/electra-small-discriminator/resolve/main/vocab.txt"
        ),
        "google/electra-base-discriminator": (
            "https://huggingface.co/google/electra-base-discriminator/resolve/main/vocab.txt"
        ),
        "google/electra-large-discriminator": (
            "https://huggingface.co/google/electra-large-discriminator/resolve/main/vocab.txt"
        ),
    },
    "tokenizer_file": {
        "google/electra-small-generator": (
            "https://huggingface.co/google/electra-small-generator/resolve/main/tokenizer.json"
        ),
        "google/electra-base-generator": (
            "https://huggingface.co/google/electra-base-generator/resolve/main/tokenizer.json"
        ),
        "google/electra-large-generator": (
            "https://huggingface.co/google/electra-large-generator/resolve/main/tokenizer.json"
        ),
        "google/electra-small-discriminator": (
            "https://huggingface.co/google/electra-small-discriminator/resolve/main/tokenizer.json"
        ),
        "google/electra-base-discriminator": (
            "https://huggingface.co/google/electra-base-discriminator/resolve/main/tokenizer.json"
        ),
        "google/electra-large-discriminator": (
            "https://huggingface.co/google/electra-large-discriminator/resolve/main/tokenizer.json"
        ),
    },
}

_UpperCamelCase				=       {
    "google/electra-small-generator": 512,
    "google/electra-base-generator": 512,
    "google/electra-large-generator": 512,
    "google/electra-small-discriminator": 512,
    "google/electra-base-discriminator": 512,
    "google/electra-large-discriminator": 512,
}

_UpperCamelCase				=       {
    "google/electra-small-generator": {"do_lower_case": True},
    "google/electra-base-generator": {"do_lower_case": True},
    "google/electra-large-generator": {"do_lower_case": True},
    "google/electra-small-discriminator": {"do_lower_case": True},
    "google/electra-base-discriminator": {"do_lower_case": True},
    "google/electra-large-discriminator": {"do_lower_case": True},
}




class  _lowerCamelCase       (			lowercase__			):



      """simple docstring"""






      UpperCAmelCase_  :					Union[str, Any]      			=VOCAB_FILES_NAMES
      UpperCAmelCase_  :					List[Any]      			=PRETRAINED_VOCAB_FILES_MAP
      UpperCAmelCase_  :					Any      			=PRETRAINED_INIT_CONFIGURATION
      UpperCAmelCase_  :					Optional[Any]      			=PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      UpperCAmelCase_  :					List[str]      			=ElectraTokenizer







      def __init__(       self ,  UpperCAmelCase=None ,  UpperCAmelCase=None ,  UpperCAmelCase=True ,  UpperCAmelCase="[UNK]" ,  UpperCAmelCase="[SEP]" ,  UpperCAmelCase="[PAD]" ,  UpperCAmelCase="[CLS]" ,  UpperCAmelCase="[MASK]" ,  UpperCAmelCase=True ,  UpperCAmelCase=None ,  **UpperCAmelCase ,  )				->      Optional[Any]:






        '''simple docstring'''






        super().__init__(
            __lowerCamelCase ,  tokenizer_file=__lowerCamelCase ,  do_lower_case=__lowerCamelCase ,  unk_token=__lowerCamelCase ,  sep_token=__lowerCamelCase ,  pad_token=__lowerCamelCase ,  cls_token=__lowerCamelCase ,  mask_token=__lowerCamelCase ,  tokenize_chinese_chars=__lowerCamelCase ,  strip_accents=__lowerCamelCase ,  **__lowerCamelCase ,  )

        __snake_case      : Optional[int]						=				json.loads(self.backend_tokenizer.normalizer.__getstate__()      )
        if (
            normalizer_state.get("lowercase" ,  __lowerCamelCase      ) != do_lower_case
            or normalizer_state.get("strip_accents" ,  __lowerCamelCase      ) != strip_accents
            or normalizer_state.get("handle_chinese_chars" ,  __lowerCamelCase      ) != tokenize_chinese_chars
        ):
          __snake_case      : List[str]						=				getattr(__lowerCamelCase ,  normalizer_state.pop("type"      )      )
          __snake_case      : Union[str, Any]						=				do_lower_case
          __snake_case      : Tuple						=				strip_accents
          __snake_case      : Optional[Any]						=				tokenize_chinese_chars
          __snake_case      : Union[str, Any]						=				normalizer_class(**__lowerCamelCase      )

        __snake_case      : Dict						=				do_lower_case







      def   UpperCAmelCase						(       self ,  UpperCAmelCase ,  UpperCAmelCase=None      )				->      Any:






        '''simple docstring'''






        __snake_case      : Optional[int]						=				[self.cls_token_id] + token_ids_a + [self.sep_token_id]

        if token_ids_a:
          output += token_ids_a + [self.sep_token_id]

        return output







      def   UpperCAmelCase						(       self ,  UpperCAmelCase ,  UpperCAmelCase = None      )				->      Any:






        '''simple docstring'''






        __snake_case      : Optional[int]						=				[self.sep_token_id]
        __snake_case      : Optional[Any]						=				[self.cls_token_id]
        if token_ids_a is None:
          return len(cls + token_ids_a + sep      ) * [0]
        return len(cls + token_ids_a + sep      ) * [0] + len(token_ids_a + sep      ) * [1]







      def   UpperCAmelCase						(       self ,  UpperCAmelCase ,  UpperCAmelCase = None      )				->      int:






        '''simple docstring'''






        __snake_case      : Optional[int]						=				self._tokenizer.model.save(__lowerCamelCase ,  name=__lowerCamelCase      )
        return tuple(__lowerCamelCase      )





import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import Audio, Features, Value
from .base import TaskTemplate







@dataclass(frozen=lowercase__)
class 			_lowercase (							lowercase__):


       """simple docstring"""




       A__											=			field(default="automatic-speech-recognition"							,  metadata={"include_in_asdict_even_if_is_default": True})
       A__											=			Features({"audio": Audio()})
       A__											=			Features({"transcription": Value("string")})
       A__											=			"audio"
       A__											=			"transcription"





       def 						lowerCAmelCase     (   self							:			Any					,      __lowerCamelCase							:			int       ):


             '''simple docstring'''



             if self.audio_column not in features:
                   raise ValueError(f"Column {self.audio_column} is not present in features."       )
             if not isinstance(features[self.audio_column]					,      __lowerCamelCase       ):
                   raise ValueError(f"Column {self.audio_column} is not an Audio type."       )
             lowerCamelCase__		:				Tuple    =  copy.deepcopy(self       )
             lowerCamelCase__		:				Tuple    =  self.input_schema.copy()
             lowerCamelCase__		:				Optional[int]    =  features[self.audio_column]
             lowerCamelCase__		:				int    =  input_schema
             return task_template





       @property
       def 						lowerCAmelCase     (   self							:			int       ):


             '''simple docstring'''



             return {self.audio_column: "audio", self.transcription_column: "transcription"}


