





from __future__ import annotations

from typing import Any




class        _a    :

      """simple docstring"""


      def __init__(		self:			Optional[int]	,    __lowerCamelCase:			int					):
          '''simple docstring'''


          UpperCamelCase__:	Optional[Any]					=     num_of_nodes
          UpperCamelCase__:	list[list[int]]					=     []
          UpperCamelCase__:	dict[int, int]					=     {}






      def 			UpperCAmelCase_       (		self:			Any	,    __lowerCamelCase:			int	,    __lowerCamelCase:			int	,    __lowerCamelCase:			int					):
          '''simple docstring'''


          self.m_edges.append([u_node, v_node, weight]					)






      def 			UpperCAmelCase_       (		self:			Dict	,    __lowerCamelCase:			int					):
          '''simple docstring'''


          if self.m_component[u_node] == u_node:
              return u_node
          return self.find_component(self.m_component[u_node]					)






      def 			UpperCAmelCase_       (		self:			str	,    __lowerCamelCase:			int					):
          '''simple docstring'''


          if self.m_component[u_node] != u_node:
              for k in self.m_component:
                  UpperCamelCase__:	Dict					=     self.find_component(__lowerCamelCase					)






      def 			UpperCAmelCase_       (		self:			str	,    __lowerCamelCase:			list[int]	,    __lowerCamelCase:			int	,    __lowerCamelCase:			int					):
          '''simple docstring'''


          if component_size[u_node] <= component_size[v_node]:
              UpperCamelCase__:	List[str]					=     v_node
              component_size[v_node] += component_size[u_node]
              self.set_component(__lowerCamelCase					)

          elif component_size[u_node] >= component_size[v_node]:
              UpperCamelCase__:	Any					=     self.find_component(__lowerCamelCase					)
              component_size[u_node] += component_size[v_node]
              self.set_component(__lowerCamelCase					)






      def 			UpperCAmelCase_       (		self:			Tuple					):
          '''simple docstring'''


          UpperCamelCase__:	Optional[int]					=     []
          UpperCamelCase__:	Optional[int]					=     0

          UpperCamelCase__:	list[Any]					=     [-1] * self.m_num_of_nodes

          # A list of components (initialized to all of the nodes)
          for node in range(self.m_num_of_nodes					):
              self.m_component.update({node: node}					)
              component_size.append(1					)

          UpperCamelCase__:	Optional[int]					=     self.m_num_of_nodes

          while num_of_components > 1:
              for edge in self.m_edges:
                  UpperCamelCase__				, UpperCamelCase__				, UpperCamelCase__:	List[str]					=     edge

                  UpperCamelCase__:	List[Any]					=     self.m_component[u]
                  UpperCamelCase__:	Tuple					=     self.m_component[v]

                  if u_component != v_component:

                      for component in (u_component, v_component):
                          if (
                              minimum_weight_edge[component] == -1
                              or minimum_weight_edge[component][2] > w
                          ):
                              UpperCamelCase__:	Any					=     [u, v, w]

              for edge in minimum_weight_edge:
                  if isinstance(__lowerCamelCase	,    __lowerCamelCase					):
                      UpperCamelCase__				, UpperCamelCase__				, UpperCamelCase__:	List[str]					=     edge

                      UpperCamelCase__:	Tuple					=     self.m_component[u]
                      UpperCamelCase__:	Optional[Any]					=     self.m_component[v]

                      if u_component != v_component:
                          mst_weight += w
                          self.union(__lowerCamelCase	,    __lowerCamelCase	,    __lowerCamelCase					)
                          print(F"Added edge [{u} - {v}]\nAdded weight: {w}\n"					)
                          num_of_components -= 1

              UpperCamelCase__:	List[Any]					=     [-1] * self.m_num_of_nodes
          print(F"The total weight of the minimal spanning tree is: {mst_weight}"					)



def 				lowerCAmelCase_ (							):
    pass


if __name__ == "__main__":
   import doctest

   doctest.testmod()








import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

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


A__:    Dict  	=	{'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json'''}

A__:    Any  	=	{
    '''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'''
        ),
    },
}

A__:    Tuple  	=	{
    '''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,
}

A__:    List[Any]  	=	{
    '''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        _a    (    UpperCamelCase__):

      """simple docstring"""


      UpperCamelCase__  		=       VOCAB_FILES_NAMES
      UpperCamelCase__  		=       PRETRAINED_VOCAB_FILES_MAP
      UpperCamelCase__  		=       PRETRAINED_INIT_CONFIGURATION
      UpperCamelCase__  		=       PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
      UpperCamelCase__  		=       ElectraTokenizer






      def __init__(		self:			List[str]	,    __lowerCamelCase:			int=None	,    __lowerCamelCase:			List[str]=None	,    __lowerCamelCase:			str=True	,    __lowerCamelCase:			Dict="[UNK]"	,    __lowerCamelCase:			Tuple="[SEP]"	,    __lowerCamelCase:			Optional[int]="[PAD]"	,    __lowerCamelCase:			str="[CLS]"	,    __lowerCamelCase:			List[str]="[MASK]"	,    __lowerCamelCase:			Optional[Any]=True	,    __lowerCamelCase:			Optional[Any]=None	,    **__lowerCamelCase:			str	,    ):
          '''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	,    )

          UpperCamelCase__:	Any					=     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
          ):
              UpperCamelCase__:	Any					=     getattr(__lowerCamelCase	,    normalizer_state.pop("type"					)					)
              UpperCamelCase__:	Union[str, Any]					=     do_lower_case
              UpperCamelCase__:	str					=     strip_accents
              UpperCamelCase__:	Any					=     tokenize_chinese_chars
              UpperCamelCase__:	Optional[Any]					=     normalizer_class(**__lowerCamelCase					)

          UpperCamelCase__:	Union[str, Any]					=     do_lower_case






      def 			UpperCAmelCase_       (		self:			Optional[int]	,    __lowerCamelCase:			List[str]	,    __lowerCamelCase:			Tuple=None					):
          '''simple docstring'''


          UpperCamelCase__:	Optional[Any]					=     [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:			Tuple	,    __lowerCamelCase:			List[int]	,    __lowerCamelCase:			Optional[List[int]] = None					):
          '''simple docstring'''


          UpperCamelCase__:	Tuple					=     [self.sep_token_id]
          UpperCamelCase__:	Union[str, 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:			Any	,    __lowerCamelCase:			str	,    __lowerCamelCase:			Optional[str] = None					):
          '''simple docstring'''


          UpperCamelCase__:	List[Any]					=     self._tokenizer.model.save(__lowerCamelCase	,    name=__lowerCamelCase					)
          return tuple(__lowerCamelCase					)

