


"""simple docstring"""




import json
import os
import unittest

from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer
from transformers.testing_utils import slow

from ...test_tokenization_common import TokenizerTesterMixin
class 					__lowerCAmelCase					(   __SCREAMING_SNAKE_CASE     ,			unittest.TestCase       ):


		'''simple docstring'''



		__UpperCAmelCase		:			str										=				BioGptTokenizer
		__UpperCAmelCase		:			List[Any]										=				False

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

				# Adapted from Sennrich et al. 2015 and https://github.com/rsennrich/subword-nmt
				__a           =			[
				    '''l''',
				    '''o''',
				    '''w''',
				    '''e''',
				    '''r''',
				    '''s''',
				    '''t''',
				    '''i''',
				    '''d''',
				    '''n''',
				    '''w</w>''',
				    '''r</w>''',
				    '''t</w>''',
				    '''lo''',
				    '''low''',
				    '''er</w>''',
				    '''low</w>''',
				    '''lowest</w>''',
				    '''newer</w>''',
				    '''wider</w>''',
				    '''<unk>''',
				]
				__a           =			dict(zip(_a							, range(len(_a      )      )      )      )
				__a           =			['''l o 123''', '''lo w 1456''', '''e r</w> 1789''', '''''']

				__a           =			os.path.join(self.tmpdirname							, VOCAB_FILES_NAMES['''vocab_file''']      )
				__a           =			os.path.join(self.tmpdirname							, VOCAB_FILES_NAMES['''merges_file''']      )
				with open(self.vocab_file							, '''w'''      ) as fp:
						fp.write(json.dumps(_a      )      )
				with open(self.merges_file							, '''w'''      ) as fp:
						fp.write('''\n'''.join(_a      )      )

		def 			__UpperCAmelCase       (  self							, _a      ):
				__a           =			'''lower newer'''
				__a           =			'''lower newer'''
				return input_text, output_text

		def 			__UpperCAmelCase       (  self      ):
				__a           =			BioGptTokenizer(self.vocab_file							, self.merges_file      )

				__a           =			'''lower'''
				__a           =			['''low''', '''er</w>''']
				__a           =			tokenizer.tokenize(_a      )
				self.assertListEqual(_a							, _a      )

				__a           =			tokens + ['''<unk>''']
				__a           =			[14, 15, 20]
				self.assertListEqual(tokenizer.convert_tokens_to_ids(_a      )							, _a      )





		@slow
		def 			__UpperCAmelCase       (  self      ):
				__a           =			BioGptTokenizer.from_pretrained('''microsoft/biogpt'''      )

				__a           =			tokenizer.encode('''sequence builders'''							, add_special_tokens=_a      )
				__a           =			tokenizer.encode('''multi-sequence build'''							, add_special_tokens=_a      )

				__a           =			tokenizer.build_inputs_with_special_tokens(_a      )
				__a           =			tokenizer.build_inputs_with_special_tokens(_a							, _a      )

				self.assertTrue(encoded_sentence == [2] + text      )
				self.assertTrue(encoded_pair == [2] + text + [2] + text_a      )










"""simple docstring"""




lowercase_			     =  [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
lowercase_			     =  [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
lowercase_			     =  {
    0: "Sunday",
    1: "Monday",
    2: "Tuesday",
    3: "Wednesday",
    4: "Thursday",
    5: "Friday",
    6: "Saturday",
}

def        lowercase							(		lowerCAmelCase__ :     int    ,					lowerCAmelCase__ :     int    ,					lowerCAmelCase__ :     int			) ->      str:
		assert len(str(lowerCAmelCase__			)			) > 2, "year should be in YYYY format"
		assert 1 <= month <= 12, "month should be between 1 to 12"
		assert 1 <= day <= 31, "day should be between 1 to 31"

		# Doomsday algorithm:
		__a           =			year // 100
		__a           =			(5 * (century % 4) + 2) % 7
		__a           =			year % 100
		__a           =			centurian % 12
		__a           =			(
		    (centurian // 12) + centurian_m + (centurian_m // 4) + century_anchor
		) % 7
		__a           =			(
		    DOOMSDAY_NOT_LEAP[month - 1]
		    if (year % 4 != 0) or (centurian == 0 and (year % 400) == 0)
		    else DOOMSDAY_LEAP[month - 1]
		)
		__a           =			(dooms_day + day - day_anchor) % 7
		return WEEK_DAY_NAMES[week_day]


if __name__ == "__main__":
				import doctest

				doctest.testmod()






