


'''simple docstring'''



import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_convbert import ConvBertTokenizer


A__						:   str				=    logging.get_logger(__name__)

A__						:   str				=    {"""vocab_file""": """vocab.txt"""}

A__						:   Union[str, Any]				=    {
    """vocab_file""": {
        """YituTech/conv-bert-base""": """https://huggingface.co/YituTech/conv-bert-base/resolve/main/vocab.txt""",
        """YituTech/conv-bert-medium-small""": (
            """https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/vocab.txt"""
        ),
        """YituTech/conv-bert-small""": """https://huggingface.co/YituTech/conv-bert-small/resolve/main/vocab.txt""",
    }
}

A__						:   Tuple				=    {
    """YituTech/conv-bert-base""": 512,
    """YituTech/conv-bert-medium-small""": 512,
    """YituTech/conv-bert-small""": 512,
}


A__						:   Optional[Any]				=    {
    """YituTech/conv-bert-base""": {"""do_lower_case""": True},
    """YituTech/conv-bert-medium-small""": {"""do_lower_case""": True},
    """YituTech/conv-bert-small""": {"""do_lower_case""": True},
}





class   UpperCAmelCase_    (_UpperCAmelCase    ):





    """simple docstring"""






    lowerCamelCase    :   Any					=     VOCAB_FILES_NAMES
    lowerCamelCase    :   Tuple					=     PRETRAINED_VOCAB_FILES_MAP
    lowerCamelCase    :   Dict					=     PRETRAINED_INIT_CONFIGURATION
    lowerCamelCase    :   str					=     PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    lowerCamelCase    :   List[str]					=     ConvBertTokenizer







    def __init__(				self     ,	SCREAMING_SNAKE_CASE_=None     ,	SCREAMING_SNAKE_CASE_=None     ,	SCREAMING_SNAKE_CASE_=True     ,	SCREAMING_SNAKE_CASE_="[UNK]"     ,	SCREAMING_SNAKE_CASE_="[SEP]"     ,	SCREAMING_SNAKE_CASE_="[PAD]"     ,	SCREAMING_SNAKE_CASE_="[CLS]"     ,	SCREAMING_SNAKE_CASE_="[MASK]"     ,	SCREAMING_SNAKE_CASE_=True     ,	SCREAMING_SNAKE_CASE_=None     ,	**SCREAMING_SNAKE_CASE_     ,	)							->	Tuple:
         super().__init__(
             SCREAMING_SNAKE_CASE_     ,	tokenizer_file=SCREAMING_SNAKE_CASE_     ,	do_lower_case=SCREAMING_SNAKE_CASE_     ,	unk_token=SCREAMING_SNAKE_CASE_     ,	sep_token=SCREAMING_SNAKE_CASE_     ,	pad_token=SCREAMING_SNAKE_CASE_     ,	cls_token=SCREAMING_SNAKE_CASE_     ,	mask_token=SCREAMING_SNAKE_CASE_     ,	tokenize_chinese_chars=SCREAMING_SNAKE_CASE_     ,	strip_accents=SCREAMING_SNAKE_CASE_     ,	**SCREAMING_SNAKE_CASE_     ,	)

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

         __lowerCamelCase  :      Tuple														=						do_lower_case







    def  lowercase_							(				self     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_=None      )							->	Dict:
         __lowerCamelCase  :      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  lowercase_							(				self     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_ = None      )							->	List[int]:
         __lowerCamelCase  :      Any														=						[self.sep_token_id]
         __lowerCamelCase  :      Tuple														=						[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  lowercase_							(				self     ,	SCREAMING_SNAKE_CASE_     ,	SCREAMING_SNAKE_CASE_ = None      )							->	Tuple[str]:
         __lowerCamelCase  :      List[Any]														=						self._tokenizer.model.save(SCREAMING_SNAKE_CASE_     ,	name=SCREAMING_SNAKE_CASE_      )
         return tuple(SCREAMING_SNAKE_CASE_      )











"""simple docstring"""







import numpy as np
from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier

def     UpperCAmelCase_					(				__a   :			dict						):




			'''simple docstring'''



			return (data["data"], data["target"])

def     UpperCAmelCase_					(				__a   :			np.ndarray      ,							__a   :			np.ndarray						):




			'''simple docstring'''



			_lowerCamelCase					:					Dict	       =    XGBClassifier()
			classifier.fit(__a      ,							__a						)
			return classifier

def     UpperCAmelCase_					(				):




			'''simple docstring'''



			_lowerCamelCase					:					List[str]	       =    load_iris()
			_lowerCamelCase       ,							_lowerCamelCase					:					Optional[Any]	       =    data_handling(__a						)
			_lowerCamelCase       ,							_lowerCamelCase       ,							_lowerCamelCase       ,							_lowerCamelCase					:					int	       =    train_test_split(
			    __a      ,							__a      ,							test_size=0.2_5						)

			_lowerCamelCase					:					Optional[Any]	       =    iris['target_names']

			# Create an XGBoost Classifier from the training data
			_lowerCamelCase					:					Tuple	       =    xgboost(__a      ,							__a						)

			# Display the confusion matrix of the classifier with both training and test sets
			ConfusionMatrixDisplay.from_estimator(
			    __a      ,							__a      ,							__a      ,							display_labels=__a      ,							cmap='Blues'      ,							normalize='true'      ,							)
			plt.title('Normalized Confusion Matrix - IRIS Dataset'						)
			plt.show()


if __name__ == "__main__":
	import doctest

	doctest.testmod(verbose=True)
	main()





