






import unittest

from transformers import AutoTokenizer, FalconConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
							import torch

							from transformers import (
							    FalconForCausalLM,
							    FalconForQuestionAnswering,
							    FalconForSequenceClassification,
							    FalconForTokenClassification,
							    FalconModel,
							)

class 				lowerCAmelCase_	:


				def __init__(					self ,						_lowerCAmelCase ,						_lowerCAmelCase=3 ,						_lowerCAmelCase=7 ,						_lowerCAmelCase=True ,						_lowerCAmelCase=True ,						_lowerCAmelCase=False ,						_lowerCAmelCase=True ,						_lowerCAmelCase=9_9 ,						_lowerCAmelCase=3_2 ,						_lowerCAmelCase=5 ,						_lowerCAmelCase=4 ,						_lowerCAmelCase=3_7 ,						_lowerCAmelCase="gelu" ,						_lowerCAmelCase=0.1 ,						_lowerCAmelCase=0.1 ,						_lowerCAmelCase=5_1_2 ,						_lowerCAmelCase=1_6 ,						_lowerCAmelCase=2 ,						_lowerCAmelCase=0.02 ,						_lowerCAmelCase=3 ,						_lowerCAmelCase=4 ,						_lowerCAmelCase=None ,						):
											_lowercase							:   Dict 							=   parent
											_lowercase							:   Optional[int] 							=   batch_size
											_lowercase							:   List[str] 							=   seq_length
											_lowercase							:   List[str] 							=   is_training
											_lowercase							:   Optional[int] 							=   use_input_mask
											_lowercase							:   Union[str, Any] 							=   use_token_type_ids
											_lowercase							:   List[str] 							=   use_labels
											_lowercase							:   Tuple 							=   vocab_size
											_lowercase							:   Tuple 							=   hidden_size
											_lowercase							:   Any 							=   num_hidden_layers
											_lowercase							:   Union[str, Any] 							=   num_attention_heads
											_lowercase							:   Dict 							=   intermediate_size
											_lowercase							:   List[str] 							=   hidden_act
											_lowercase							:   Any 							=   hidden_dropout_prob
											_lowercase							:   Dict 							=   attention_probs_dropout_prob
											_lowercase							:   Optional[int] 							=   max_position_embeddings
											_lowercase							:   Optional[Any] 							=   type_vocab_size
											_lowercase							:   str 							=   type_sequence_label_size
											_lowercase							:   str 							=   initializer_range
											_lowercase							:   List[Any] 							=   num_labels
											_lowercase							:   List[str] 							=   num_choices
											_lowercase							:   Union[str, Any] 							=   scope


				def 						__a					(					self      ):
											_lowercase							:   Optional[int] 							=   ids_tensor([self.batch_size, self.seq_length] ,						self.vocab_size      )

											_lowercase							:   str 							=   None
											if self.use_input_mask:
																		_lowercase							:   Optional[Any] 							=   random_attention_mask([self.batch_size, self.seq_length]      )

											_lowercase							:   str 							=   None

											_lowercase							:   List[str] 							=   None
											_lowercase							:   Optional[int] 							=   None
											_lowercase							:   List[str] 							=   None
											if self.use_labels:
																		_lowercase							:   Optional[Any] 							=   ids_tensor([self.batch_size] ,						self.type_sequence_label_size      )
																		_lowercase							:   Dict 							=   ids_tensor([self.batch_size, self.seq_length] ,						self.num_labels      )
																		_lowercase							:   Union[str, Any] 							=   ids_tensor([self.batch_size] ,						self.num_choices      )

											_lowercase							:   Optional[int] 							=   self.get_config()

											return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels


				def 						__a					(					self      ):
											return FalconConfig(
											    vocab_size=self.vocab_size ,						hidden_size=self.hidden_size ,						num_hidden_layers=self.num_hidden_layers ,						num_attention_heads=self.num_attention_heads ,						intermediate_size=self.intermediate_size ,						hidden_act=self.hidden_act ,						hidden_dropout_prob=self.hidden_dropout_prob ,						attention_probs_dropout_prob=self.attention_probs_dropout_prob ,						max_position_embeddings=self.max_position_embeddings ,						type_vocab_size=self.type_vocab_size ,						is_decoder=_lowerCAmelCase ,						initializer_range=self.initializer_range ,						pad_token_id=1 ,						new_decoder_architecture=_lowerCAmelCase ,						)


				def 						__a					(					self ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase      ):
											_lowercase							:   Dict 							=   FalconModel(config=_lowerCAmelCase      )
											model.to(_lowerCAmelCase      )
											model.eval()
											_lowercase							:   Optional[Any] 							=   model(_lowerCAmelCase ,						attention_mask=_lowerCAmelCase      )
											_lowercase							:   str 							=   model(_lowerCAmelCase      )
											self.parent.assertEqual(result.last_hidden_state.shape ,						(self.batch_size, self.seq_length, self.hidden_size)      )


				def 						__a					(					self ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						):
											_lowercase							:   Union[str, Any] 							=   True
											_lowercase							:   str 							=   FalconModel(_lowerCAmelCase      )
											model.to(_lowerCAmelCase      )
											model.eval()
											_lowercase							:   Any 							=   model(
											    _lowerCAmelCase ,						attention_mask=_lowerCAmelCase ,						encoder_hidden_states=_lowerCAmelCase ,						encoder_attention_mask=_lowerCAmelCase ,						)
											_lowercase							:   List[Any] 							=   model(
											    _lowerCAmelCase ,						attention_mask=_lowerCAmelCase ,						encoder_hidden_states=_lowerCAmelCase ,						)
											_lowercase							:   Tuple 							=   model(_lowerCAmelCase ,						attention_mask=_lowerCAmelCase      )
											self.parent.assertEqual(result.last_hidden_state.shape ,						(self.batch_size, self.seq_length, self.hidden_size)      )


				def 						__a					(					self ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						):
											_lowercase							:   Union[str, Any] 							=   FalconForCausalLM(config=_lowerCAmelCase      )
											model.to(_lowerCAmelCase      )
											model.eval()
											_lowercase							:   Tuple 							=   model(_lowerCAmelCase ,						attention_mask=_lowerCAmelCase ,						labels=_lowerCAmelCase      )
											self.parent.assertEqual(result.logits.shape ,						(self.batch_size, self.seq_length, self.vocab_size)      )


				def 						__a					(					self ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						_lowerCAmelCase ,						):
											_lowercase							:   Optional[Any] 							=   True
											_lowercase							:   Dict 							=   True
											_lowercase							:   Optional[int] 							=   FalconForCausalLM(config=_lowerCAmelCase      )
											model.to(_lowerCAmelCase      )
											model.eval()

											# first forward pass
											_lowercase							:   Tuple 							=   model(
											    _lowerCAmelCase ,						attention_mask=_lowerCAmelCase ,						encoder_hidden_states=_lowerCAmelCase ,						encoder_attention_mask=_lowerCAmelCase ,						use_cache=_lowerCAmelCase ,						)
											_lowercase							:   Optional[Any] 							=   outputs.past_key_values

											# create hypothetical multiple next token and extent to next_input_ids
											_lowercase							:   List[str] 							=   ids_tensor((self.batch_size, 3) ,						config.vocab_size      )
											_lowercase							:   List[Any] 							=   ids_tensor((self.batch_size, 3) ,						vocab_size=2      )

											# append to next input_ids and
											_lowercase							:   Union[str, Any] 							=   torch.cat([input_ids, next_tokens] ,						dim=-1      )
											_lowercase							:   Optional[int] 							=   torch.cat([input_mask, next_mask] ,						dim=-1      )

											_lowercase							:   Tuple 							=   model(
											    _lowerCAmelCase ,						attention_mask=_lowerCAmelCase ,						encoder_hidden_states=_lowerCAmelCase ,						encoder_attention_mask=_lowerCAmelCase ,						output_hidden_states=_lowerCAmelCase ,						)['hidden_states'][0]
											_lowercase							:   Any 							=   model(
											    _lowerCAmelCase ,						attention_mask=_lowerCAmelCase ,						encoder_hidden_states=_lowerCAmelCase ,						encoder_attention_mask=_lowerCAmelCase ,						past_key_values=_lowerCAmelCase ,						output_hidden_states=_lowerCAmelCase ,						)['hidden_states'][0]

											# select random slice
											_lowercase							:   Union[str, Any] 							=   ids_tensor((1,) ,						output_from_past.shape[-1]      ).item()
											_lowercase							:   Union[str, Any] 							=   output_from_no_past[:, -3:, random_slice_idx].detach()
											_lowercase							:   Tuple 							=   output_from_past[:, :, random_slice_idx].detach()

											self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1]      )

											# test that outputs are equal for slice
											self.parent.assertTrue(torch.allclose(_lowerCAmelCase ,						_lowerCAmelCase ,						atol=1E-3      )      )


				def 						__a					(					self      ):
											_lowercase							:   Optional[int] 							=   self.prepare_config_and_inputs()
											(
											    (
											    _lowercase
											)							,							(
											    _lowercase
											)							,							(
											    _lowercase
											)							,							(
											    _lowercase
											)							,							(
											    _lowercase
											)							,							(
											    _lowercase
											)							,							(
											    _lowercase
											)							,							
											)							:   Union[str, Any] 							=   config_and_inputs
											_lowercase							:   List[Any] 							=   {'input_ids': input_ids, 'attention_mask': input_mask}
											return config, inputs_dict




@require_torch
class 				lowerCAmelCase_	(		__snake_case   ,		__snake_case   ,		__snake_case   ,		unittest.TestCase			):
				_UpperCamelCase					:       Union[str, Any]							       = (
				    (
				        FalconModel,
				        FalconForCausalLM,
				        FalconForSequenceClassification,
				        FalconForTokenClassification,
				        FalconForQuestionAnswering,
				    )
				    if is_torch_available()
				    else ()
				)
				_UpperCamelCase					:       Optional[Any]							       = (FalconForCausalLM,) if is_torch_available() else ()
				_UpperCamelCase					:       str							       = (
				    {
				        "feature-extraction": FalconModel,
				        "text-classification": FalconForSequenceClassification,
				        "text-generation": FalconForCausalLM,
				        "question-answering": FalconForQuestionAnswering,
				        "token-classification": FalconForTokenClassification,
				        "zero-shot": FalconForSequenceClassification,
				    }
				    if is_torch_available()
				    else {}
				)
				_UpperCamelCase					:       Tuple							       = False
				_UpperCamelCase					:       str							       = False


				def 						__a					(					self      ):
											_lowercase							:   Dict 							=   FalconModelTester(self      )
											_lowercase							:   Dict 							=   ConfigTester(self ,						config_class=_lowerCAmelCase ,						hidden_size=3_7      )


				def 						__a					(					self      ):
											self.config_tester.run_common_tests()


				def 						__a					(					self      ):
											_lowercase							:   int 							=   self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*_lowerCAmelCase      )


				def 						__a					(					self      ):
											_lowercase							,							*_lowercase							:   Dict 							=   self.model_tester.prepare_config_and_inputs()
											for alibi in [True, False]:
																		_lowercase							:   Union[str, Any] 							=   alibi
																		self.model_tester.create_and_check_model(_lowerCAmelCase ,						*_lowerCAmelCase      )


				def 						__a					(					self      ):
											_lowercase							,							_lowercase							:   Tuple 							=   self.model_tester.prepare_config_and_inputs_for_common()
											_lowercase							:   Optional[Any] 							=   3
											_lowercase							:   int 							=   input_dict['input_ids']
											_lowercase							:   List[Any] 							=   input_ids.ne(1      ).to(_lowerCAmelCase      )
											_lowercase							:   Optional[int] 							=   ids_tensor([self.model_tester.batch_size] ,						self.model_tester.type_sequence_label_size      )
											_lowercase							:   List[str] 							=   FalconForSequenceClassification(_lowerCAmelCase      )
											model.to(_lowerCAmelCase      )
											model.eval()
											_lowercase							:   Tuple 							=   model(_lowerCAmelCase ,						attention_mask=_lowerCAmelCase ,						labels=_lowerCAmelCase      )
											self.assertEqual(result.logits.shape ,						(self.model_tester.batch_size, self.model_tester.num_labels)      )


				def 						__a					(					self      ):
											_lowercase							,							_lowercase							:   Any 							=   self.model_tester.prepare_config_and_inputs_for_common()
											_lowercase							:   List[Any] 							=   3
											_lowercase							:   Tuple 							=   'single_label_classification'
											_lowercase							:   Dict 							=   input_dict['input_ids']
											_lowercase							:   Union[str, Any] 							=   input_ids.ne(1      ).to(_lowerCAmelCase      )
											_lowercase							:   Dict 							=   ids_tensor([self.model_tester.batch_size] ,						self.model_tester.type_sequence_label_size      )
											_lowercase							:   Tuple 							=   FalconForSequenceClassification(_lowerCAmelCase      )
											model.to(_lowerCAmelCase      )
											model.eval()
											_lowercase							:   Optional[Any] 							=   model(_lowerCAmelCase ,						attention_mask=_lowerCAmelCase ,						labels=_lowerCAmelCase      )
											self.assertEqual(result.logits.shape ,						(self.model_tester.batch_size, self.model_tester.num_labels)      )


				def 						__a					(					self      ):
											_lowercase							,							_lowercase							:   List[str] 							=   self.model_tester.prepare_config_and_inputs_for_common()
											_lowercase							:   Optional[Any] 							=   input_dict['input_ids']
											_lowercase							:   Union[str, Any] 							=   FalconForCausalLM(_lowerCAmelCase      )
											model.to(_lowerCAmelCase      )
											model.eval()
											_lowercase							:   List[Any] 							=   model(_lowerCAmelCase ,						use_cache=_lowerCAmelCase      )
											_lowercase							:   int 							=   input_ids.shape[0]
											_lowercase							:   str 							=   model._convert_to_rw_cache(result.past_key_values      )
											_lowercase							:   List[str] 							=   model._convert_cache_to_standard_format(_lowerCAmelCase ,						_lowerCAmelCase      )
											for layer in range(len(_lowerCAmelCase      )      ):
																		for tensor_idx in range(2      ):
																									self.assertTrue(rw_cache[layer][tensor_idx].ndim == 3      )
																									self.assertTrue(result.past_key_values[layer][tensor_idx].ndim == 4      )
																									self.assertTrue(
																									    torch.all(result.past_key_values[layer][tensor_idx] == standard_cache[layer][tensor_idx]      )      )


				def 						__a					(					self      ):
											_lowercase							,							_lowercase							:   List[str] 							=   self.model_tester.prepare_config_and_inputs_for_common()
											_lowercase							:   List[str] 							=   3
											_lowercase							:   List[Any] 							=   'multi_label_classification'
											_lowercase							:   Union[str, Any] 							=   input_dict['input_ids']
											_lowercase							:   int 							=   input_ids.ne(1      ).to(_lowerCAmelCase      )
											_lowercase							:   List[str] 							=   ids_tensor(
											    [self.model_tester.batch_size, config.num_labels] ,						self.model_tester.type_sequence_label_size      ).to(torch.float      )
											_lowercase							:   Dict 							=   FalconForSequenceClassification(_lowerCAmelCase      )
											model.to(_lowerCAmelCase      )
											model.eval()
											_lowercase							:   Optional[Any] 							=   model(_lowerCAmelCase ,						attention_mask=_lowerCAmelCase ,						labels=_lowerCAmelCase      )
											self.assertEqual(result.logits.shape ,						(self.model_tester.batch_size, self.model_tester.num_labels)      )


				def 						__a					(					self      ):
											# Falcon can have different numbers of KV-heads than the number of query heads, so we need
											# to override this test to use the right head counts.
											for model_class in self.all_generative_model_classes:
																		_lowercase							,							_lowercase							:   Any 							=   self.model_tester.prepare_config_and_inputs_for_common()

																		# If it doesn't support cache, pass the test
																		if not hasattr(_lowerCAmelCase ,						'use_cache'      ):
																									return

																		_lowercase							:   Any 							=   model_class(_lowerCAmelCase      ).to(_lowerCAmelCase      )
																		if "use_cache" not in inputs:
																									_lowercase							:   Optional[int] 							=   True
																		_lowercase							:   Tuple 							=   model(**_lowerCAmelCase      )

																		# If "past_key_values" is not returned, pass the test (e.g. RWKV uses a different cache name and format)
																		if "past_key_values" not in outputs:
																									return

																		_lowercase							:   str 							=   (
																		    getattr(_lowerCAmelCase ,						'decoder_layers' ,						_lowerCAmelCase      )
																		    or getattr(_lowerCAmelCase ,						'num_decoder_layers' ,						_lowerCAmelCase      )
																		    or config.num_hidden_layers
																		)
																		_lowercase							:   Tuple 							=   getattr(_lowerCAmelCase ,						'num_kv_heads' ,						config.num_attention_heads      )
																		_lowercase							:   Any 							=   getattr(_lowerCAmelCase ,						'd_model' ,						config.hidden_size      )
																		_lowercase							:   List[Any] 							=   embed_dim // num_attention_heads

																		_lowercase							:   List[str] 							=   outputs['past_key_values']
																		self.assertEqual(len(_lowerCAmelCase      ) ,						_lowerCAmelCase      )

																		_lowercase							,							_lowercase							:   Optional[Any] 							=   inputs['input_ids'].shape
																		for i in range(_lowerCAmelCase      ):
																									if config.new_decoder_architecture:
																																_lowercase							:   Dict 							=   config.num_attention_heads
																									elif config.multi_query:
																																_lowercase							:   Dict 							=   1
																									self.assertEqual(len(past_kv[0]      ) ,						2      )  # K V for the decoder = 2
																									self.assertEqual(
																									    past_kv[i][0].shape ,						(batch_size, num_attention_heads, seq_length, per_head_embed_dim)      )
																									self.assertEqual(
																									    past_kv[i][1].shape ,						(batch_size, num_attention_heads, seq_length, per_head_embed_dim)      )




@require_torch
class 				lowerCAmelCase_	(		unittest.TestCase			):


				@slow
				def 						__a					(					self      ):
											_lowercase							:   List[str] 							=   AutoTokenizer.from_pretrained('Rocketknight1/falcon-rw-1b'      )
											_lowercase							:   Any 							=   FalconForCausalLM.from_pretrained('Rocketknight1/falcon-rw-1b'      )
											model.eval()
											model.to(_lowerCAmelCase      )
											_lowercase							:   Union[str, Any] 							=   tokenizer('My favorite food is' ,						return_tensors='pt'      ).to(_lowerCAmelCase      )

											_lowercase							:   Tuple 							=   (
											    'My favorite food is pizza. I love it so much that I have a pizza party every year for my birthday.'
											)

											_lowercase							:   Optional[Any] 							=   model.generate(**_lowerCAmelCase ,						do_sample=_lowerCAmelCase ,						max_new_tokens=1_9      )
											_lowercase							:   Tuple 							=   tokenizer.batch_decode(_lowerCAmelCase      )[0]

											self.assertEqual(_lowerCAmelCase ,						_lowerCAmelCase      )


				@slow
				def 						__a					(					self      ):
											# The big models are way too big for the CI, so we use tiny random models that resemble their
											# architectures but with much smaller and fewer layers
											for repo in ["Rocketknight1/tiny-random-falcon-7b", "Rocketknight1/tiny-random-falcon-40b"]:
																		_lowercase							:   List[str] 							=   AutoTokenizer.from_pretrained(_lowerCAmelCase      )
																		_lowercase							:   str 							=   FalconForCausalLM.from_pretrained(_lowerCAmelCase      )
																		model.eval()
																		model.to(_lowerCAmelCase      )
																		_lowercase							:   str 							=   tokenizer('My favorite food is' ,						return_tensors='pt'      ).to(_lowerCAmelCase      )

																		# We just test that these run without errors - the models are randomly initialized
																		# and so the actual text outputs will be garbage
																		model.generate(**_lowerCAmelCase ,						do_sample=_lowerCAmelCase ,						max_new_tokens=4      )
																		model.generate(**_lowerCAmelCase ,						do_sample=_lowerCAmelCase ,						max_new_tokens=4      )
																		model.generate(**_lowerCAmelCase ,						num_beams=2 ,						max_new_tokens=4      )


				@slow
				def 						__a					(					self      ):
											# The big models are way too big for the CI, so we use tiny random models that resemble their
											# architectures but with much smaller and fewer layers
											with torch.no_grad():
																		for repo in [
																		    "Rocketknight1/falcon-rw-1b",
																		    "Rocketknight1/tiny-random-falcon-7b",
																		    "Rocketknight1/tiny-random-falcon-40b",
																		]:
																									_lowercase							:   str 							=   AutoTokenizer.from_pretrained(_lowerCAmelCase      )
																									_lowercase							:   Union[str, Any] 							=   FalconForCausalLM.from_pretrained(_lowerCAmelCase      )
																									model.eval()
																									model.to(device=_lowerCAmelCase      )
																									_lowercase							:   Any 							=   tokenizer('My favorite food is' ,						return_tensors='pt'      ).to(_lowerCAmelCase      )

																									# Test results are the same with and without cache
																									_lowercase							:   str 							=   model.generate(**_lowerCAmelCase ,						do_sample=_lowerCAmelCase ,						max_new_tokens=2_0 ,						use_cache=_lowerCAmelCase      )
																									_lowercase							:   Dict 							=   model.generate(**_lowerCAmelCase ,						do_sample=_lowerCAmelCase ,						max_new_tokens=2_0 ,						use_cache=_lowerCAmelCase      )
																									self.assertTrue((outputs_cache - outputs_no_cache).sum().item() == 0      )










from __future__ import annotations

import math
from collections import Counter
from string import ascii_lowercase







def      lowerCamelCase_						(			UpperCamelCase__							: str )	->			None:





				"""simple docstring"""


				__lowerCamelCase			,		__lowerCamelCase									=       analyze_text(UpperCamelCase__ )
				__lowerCamelCase									=       list(' ' + ascii_lowercase )
				# what is our total sum of probabilities.
				__lowerCamelCase									=       sum(single_char_strings.values() )

				# one length string
				__lowerCamelCase									=       0
				# for each alpha we go in our dict and if it is in it we calculate entropy
				for ch in my_alphas:
								if ch in single_char_strings:
												__lowerCamelCase									=       single_char_strings[ch]
												__lowerCamelCase									=       my_str / all_sum
												my_fir_sum += prob * math.loga(UpperCamelCase__ )  # entropy formula.

    # print entropy
				print(F"""{round(-1 * my_fir_sum ):.1f}""" )

				# two len string
				__lowerCamelCase									=       sum(two_char_strings.values() )
				__lowerCamelCase									=       0
				# for each alpha (two in size) calculate entropy.
				for cha in my_alphas:
								for cha in my_alphas:
												__lowerCamelCase									=       cha + cha
												if sequence in two_char_strings:
																__lowerCamelCase									=       two_char_strings[sequence]
																__lowerCamelCase									=       int(UpperCamelCase__ ) / all_sum
																my_sec_sum += prob * math.loga(UpperCamelCase__ )

    # print second entropy
				print(F"""{round(-1 * my_sec_sum ):.1f}""" )

				# print the difference between them
				print(F"""{round((-1 * my_sec_sum) - (-1 * my_fir_sum) ):.1f}""" )







def      lowerCamelCase_						(			UpperCamelCase__							: str )	->			tuple[dict, dict]:





				"""simple docstring"""


				__lowerCamelCase									=       Counter()  # type: ignore
				__lowerCamelCase									=       Counter()  # type: ignore
				single_char_strings[text[-1]] += 1

				# first case when we have space at start.
				two_char_strings[" " + text[0]] += 1
				for i in range(0					,	len(UpperCamelCase__ ) - 1 ):
								single_char_strings[text[i]] += 1
								two_char_strings[text[i : i + 2]] += 1
				return single_char_strings, two_char_strings







def      lowerCamelCase_						(			)	->			Dict:





				"""simple docstring"""


				import doctest

				doctest.testmod()
				# text = (
				#     "Had repulsive dashwoods suspicion sincerity but advantage now him. Remark "
				#     "easily garret nor nay. Civil those mrs enjoy shy fat merry. You greatest "
				#     "jointure saw horrible. He private he on be imagine suppose. Fertile "
				#     "beloved evident through no service elderly is. Blind there if every no so "
				#     "at. Own neglected you preferred way sincerity delivered his attempted. To "
				#     "of message cottage windows do besides against uncivil.  Delightful "
				#     "unreserved impossible few estimating men favourable see entreaties. She "
				#     "propriety immediate was improving. He or entrance humoured likewise "
				#     "moderate. Much nor game son say feel. Fat make met can must form into "
				#     "gate. Me we offending prevailed discovery. "
				# )

				# calculate_prob(text)


if __name__ == "__main__":
					main()


