





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available


_UpperCAmelCase       : List[Any]			     =       {"""tokenization_herbert""": ["""HerbertTokenizer"""]}

try:
    if not is_tokenizers_available():
        raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
    pass
else:
    _UpperCAmelCase       : List[str]			     =       ["""HerbertTokenizerFast"""]


if TYPE_CHECKING:
    from .tokenization_herbert import HerbertTokenizer

    try:
        if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
    except OptionalDependencyNotAvailable:
        pass
    else:
        from .tokenization_herbert_fast import HerbertTokenizerFast

else:
    import sys

    _UpperCAmelCase       : str			     =       _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)












class      lowerCAmelCase							:
 def __init__(   self						:   Union[str, Any]    ,  UpperCAmelCase						:   list			)    ->			None:
     lowerCamelCase__					:   int      				=	set_counts
     lowerCamelCase__					:   List[str]      				=	max(UpperCAmelCase			)
     lowerCamelCase__					:   Dict      				=	len(UpperCAmelCase			)
     lowerCamelCase__					:   List[str]      				=	[1] * num_sets
     lowerCamelCase__					:   List[str]      				=	list(range(UpperCAmelCase			)			)
 def   A_			(   self						:   Dict    ,  UpperCAmelCase						:   int    ,  UpperCAmelCase						:   int			)    ->			bool:
     lowerCamelCase__					:   List[str]      				=	self.get_parent(UpperCAmelCase			)
     lowerCamelCase__					:   List[str]      				=	self.get_parent(UpperCAmelCase			)

     if src_parent == dst_parent:
         return False

     if self.ranks[dst_parent] >= self.ranks[src_parent]:
         self.set_counts[dst_parent] += self.set_counts[src_parent]
         lowerCamelCase__					:   Union[str, Any]      				=	0
         lowerCamelCase__					:   str      				=	dst_parent
         if self.ranks[dst_parent] == self.ranks[src_parent]:
             self.ranks[dst_parent] += 1
         lowerCamelCase__					:   int      				=	self.set_counts[dst_parent]
     else:
         self.set_counts[src_parent] += self.set_counts[dst_parent]
         lowerCamelCase__					:   List[str]      				=	0
         lowerCamelCase__					:   Tuple      				=	src_parent
         lowerCamelCase__					:   List[str]      				=	self.set_counts[src_parent]

     lowerCamelCase__					:   Optional[int]      				=	max(self.max_set    ,  UpperCAmelCase			)
     return True







 def   A_			(   self						:   str    ,  UpperCAmelCase						:   int			)    ->			int:
     if self.parents[disj_set] == disj_set:
         return disj_set
     lowerCamelCase__					:   Dict      				=	self.get_parent(self.parents[disj_set]			)
     return self.parents[disj_set]





