


from ...configuration_utils import PretrainedConfig
from ...utils import logging


UpperCAmelCase_      : Optional[int]  					=       logging.get_logger(__name__)

UpperCAmelCase_      : Tuple  					=       {
    'facebook/dpr-ctx_encoder-single-nq-base': (
        'https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolve/main/config.json'
    ),
    'facebook/dpr-question_encoder-single-nq-base': (
        'https://huggingface.co/facebook/dpr-question_encoder-single-nq-base/resolve/main/config.json'
    ),
    'facebook/dpr-reader-single-nq-base': (
        'https://huggingface.co/facebook/dpr-reader-single-nq-base/resolve/main/config.json'
    ),
    'facebook/dpr-ctx_encoder-multiset-base': (
        'https://huggingface.co/facebook/dpr-ctx_encoder-multiset-base/resolve/main/config.json'
    ),
    'facebook/dpr-question_encoder-multiset-base': (
        'https://huggingface.co/facebook/dpr-question_encoder-multiset-base/resolve/main/config.json'
    ),
    'facebook/dpr-reader-multiset-base': (
        'https://huggingface.co/facebook/dpr-reader-multiset-base/resolve/main/config.json'
    ),
}
class  SCREAMING_SNAKE_CASE__  (				UpperCamelCase__			):
      snake_case__				:     Optional[Any]        =						'''dpr'''
      def __init__(       self				:       Optional[Any]     ,							SCREAMING_SNAKE_CASE__				:       List[Any]=3_0_5_2_2     ,							SCREAMING_SNAKE_CASE__				:       Optional[Any]=7_6_8     ,							SCREAMING_SNAKE_CASE__				:       Dict=1_2     ,							SCREAMING_SNAKE_CASE__				:       str=1_2     ,							SCREAMING_SNAKE_CASE__				:       Dict=3_0_7_2     ,							SCREAMING_SNAKE_CASE__				:       Optional[int]="gelu"     ,							SCREAMING_SNAKE_CASE__				:       Union[str, Any]=0.1     ,							SCREAMING_SNAKE_CASE__				:       List[Any]=0.1     ,							SCREAMING_SNAKE_CASE__				:       Dict=5_1_2     ,							SCREAMING_SNAKE_CASE__				:       int=2     ,							SCREAMING_SNAKE_CASE__				:       Dict=0.02     ,							SCREAMING_SNAKE_CASE__				:       Optional[int]=1E-12     ,							SCREAMING_SNAKE_CASE__				:       str=0     ,							SCREAMING_SNAKE_CASE__				:       Optional[Any]="absolute"     ,							SCREAMING_SNAKE_CASE__				:       int = 0     ,							**SCREAMING_SNAKE_CASE__				:       Optional[Any]     ,							)		->			Tuple:
             super().__init__(pad_token_id=UpperCamelCase_     ,							**UpperCamelCase_     )

             a_					:		Optional[Any]							=  vocab_size
             a_					:		Union[str, Any]							=  hidden_size
             a_					:		int							=  num_hidden_layers
             a_					:		int							=  num_attention_heads
             a_					:		List[str]							=  hidden_act
             a_					:		Dict							=  intermediate_size
             a_					:		Any							=  hidden_dropout_prob
             a_					:		List[Any]							=  attention_probs_dropout_prob
             a_					:		Optional[int]							=  max_position_embeddings
             a_					:		List[Any]							=  type_vocab_size
             a_					:		Any							=  initializer_range
             a_					:		Tuple							=  layer_norm_eps
             a_					:		List[str]							=  projection_dim
             a_					:		str							=  position_embedding_type






class        _a							:

							def __init__(							self:	Any							)			->   Tuple:





									"""simple docstring"""







									lowercase__            =      ''''''
									lowercase__            =      ''''''
									lowercase__            =      []

							def       lowerCamelCase_ (							self:	Union[str, Any]    ,						UpperCamelCase_:	int    ,						UpperCamelCase_:	int							)			->   int:





									"""simple docstring"""







									if m == -1:
											return n + 1
									elif n == -1:
											return m + 1
									elif self.dp[m][n] > -1:
											return self.dp[m][n]
									else:
											if self.worda[m] == self.worda[n]:
													lowercase__            =      self.__min_dist_top_down_dp(m - 1    ,						n - 1							)
											else:
													lowercase__            =      self.__min_dist_top_down_dp(UpperCamelCase_    ,						n - 1							)
													lowercase__            =      self.__min_dist_top_down_dp(m - 1    ,						UpperCamelCase_							)
													lowercase__            =      self.__min_dist_top_down_dp(m - 1    ,						n - 1							)
													lowercase__            =      1 + min(UpperCamelCase_    ,						UpperCamelCase_    ,						UpperCamelCase_							)

											return self.dp[m][n]

							def       lowerCamelCase_ (							self:	Union[str, Any]    ,						UpperCamelCase_:	str    ,						UpperCamelCase_:	str							)			->   int:





									"""simple docstring"""







									lowercase__            =      worda
									lowercase__            =      worda
									lowercase__            =      [[-1 for _ in range(len(UpperCamelCase_							)							)] for _ in range(len(UpperCamelCase_							)							)]

									return self.__min_dist_top_down_dp(len(UpperCamelCase_							) - 1    ,						len(UpperCamelCase_							) - 1							)


							def       lowerCamelCase_ (							self:	int    ,						UpperCamelCase_:	str    ,						UpperCamelCase_:	str							)			->   int:





									"""simple docstring"""







									lowercase__            =      worda
									lowercase__            =      worda
									lowercase__            =      len(UpperCamelCase_							)
									lowercase__            =      len(UpperCamelCase_							)
									lowercase__            =      [[0 for _ in range(n + 1							)] for _ in range(m + 1							)]

									for i in range(m + 1							):
											for j in range(n + 1							):
													if i == 0:  # first string is empty
															lowercase__            =      j
													elif j == 0:  # second string is empty
															lowercase__            =      i
													elif worda[i - 1] == worda[j - 1]:  # last characters are equal
															lowercase__            =      self.dp[i - 1][j - 1]
													else:
															lowercase__            =      self.dp[i][j - 1]
															lowercase__            =      self.dp[i - 1][j]
															lowercase__            =      self.dp[i - 1][j - 1]
															lowercase__            =      1 + min(UpperCamelCase_    ,						UpperCamelCase_    ,						UpperCamelCase_							)
									return self.dp[m][n]


if __name__ == "__main__":
			lowerCAmelCase       =							EditDistance()

			print('****************** Testing Edit Distance DP Algorithm ******************')
			print()

			lowerCAmelCase       =							input('Enter the first string: ').strip()
			lowerCAmelCase       =							input('Enter the second string: ').strip()

			print()
			print(f"""The minimum edit distance is: {solver.min_dist_top_down(Sa, Sa)}""")
			print(f"""The minimum edit distance is: {solver.min_dist_bottom_up(Sa, Sa)}""")
			print()
			print('*************** End of Testing Edit Distance DP Algorithm ***************')


