


'''simple docstring'''



import os
import unittest

from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer
from transformers.testing_utils import require_jieba, tooslow

from ...test_tokenization_common import TokenizerTesterMixin


@require_jieba
class 						_snake_case    (   __UpperCAmelCase				,      unittest.TestCase		):
					lowerCAmelCase					:Optional[Any]            =    CpmAntTokenizer
					lowerCAmelCase					:Tuple            =    False




					def  snake_case__  (					self):
								super().setUp()

								UpperCAmelCase__     :    Optional[int]         =   [
								    """<d>""",
								    """</d>""",
								    """<s>""",
								    """</s>""",
								    """</_>""",
								    """<unk>""",
								    """<pad>""",
								    """</n>""",
								    """我""",
								    """是""",
								    """C""",
								    """P""",
								    """M""",
								    """A""",
								    """n""",
								    """t""",
								]
								UpperCAmelCase__     :    Union[str, Any]         =   os.path.join(self.tmpdirname							,							VOCAB_FILES_NAMES["""vocab_file"""])
								with open(self.vocab_file							,							"""w"""							,							encoding="""utf-8""") as vocab_writer:
											vocab_writer.write("""""".join([x + """\n""" for x in vocab_tokens]))




					@tooslow
					def  snake_case__  (					self):
								UpperCAmelCase__     :    List[str]         =   CpmAntTokenizer.from_pretrained("""openbmb/cpm-ant-10b""")
								UpperCAmelCase__     :    int         =   """今天天气真好！"""
								UpperCAmelCase__     :    str         =   ["""今天""", """天气""", """真""", """好""", """！"""]
								UpperCAmelCase__     :    Any         =   tokenizer.tokenize(__SCREAMING_SNAKE_CASE)
								self.assertListEqual(__SCREAMING_SNAKE_CASE							,							__SCREAMING_SNAKE_CASE)
								UpperCAmelCase__     :    Tuple         =   """今天天气真好！"""
								UpperCAmelCase__     :    List[Any]         =   [tokenizer.bos_token] + tokens

								UpperCAmelCase__     :    Any         =   [6, 9802, 1_4962, 2082, 831, 244]
								self.assertListEqual(tokenizer.convert_tokens_to_ids(__SCREAMING_SNAKE_CASE)							,							__SCREAMING_SNAKE_CASE)

								UpperCAmelCase__     :    Optional[Any]         =   tokenizer.decode(__SCREAMING_SNAKE_CASE)
								self.assertEqual(__SCREAMING_SNAKE_CASE							,							__SCREAMING_SNAKE_CASE)




from collections import defaultdict





def      __snake_case	(			_UpperCAmelCase   , _UpperCAmelCase				):
    __a						       =				first_str.lower().strip()
    __a						       =				second_str.lower().strip()

    # Remove whitespace
    __a						       =				first_str.replace(''' '''   , ''''''				)
    __a						       =				second_str.replace(''' '''   , ''''''				)

    # Strings of different lengths are not anagrams
    if len(_UpperCAmelCase				) != len(_UpperCAmelCase				):
        return False

    # Default values for count should be 0
    __a						       =				defaultdict(_UpperCAmelCase				)

    # For each character in input strings,
    # increment count in the corresponding
    for i in range(len(_UpperCAmelCase				)				):
        count[first_str[i]] += 1
        count[second_str[i]] -= 1

    return all(_count == 0 for _count in count.values()				)


if __name__ == "__main__":
 from doctest import testmod

 testmod()
 __snake_case						:Any      		=     input('''Enter the first string ''').strip()
 __snake_case						:int      		=     input('''Enter the second string ''').strip()

 __snake_case						:int      		=     check_anagrams(input_a, input_b)
 print(f'{input_a} and {input_b} are {"" if status else "not "}anagrams.')





