


'''simple docstring'''






import pytest

from datasets.splits import SplitDict, SplitInfo
from datasets.utils.py_utils import asdict






@pytest.mark.parametrize(
    'split_dict'				,						[
        SplitDict(),
        SplitDict({'train': SplitInfo(name='train'				,						num_bytes=13_37				,						num_examples=42				,						dataset_name='my_dataset'		)}		),
        SplitDict({'train': SplitInfo(name='train'				,						num_bytes=13_37				,						num_examples=42		)}		),
        SplitDict({'train': SplitInfo()}		),
    ]				,						)
def 	_A				(lowerCAmelCase__  :SplitDict		)   ->  Any:




     '''simple docstring'''



     _a			      =							split_dict._to_yaml_list()
     assert len(lowerCAmelCase__		) == len(lowerCAmelCase__		)
     _a			      =							SplitDict._from_yaml_list(lowerCAmelCase__		)
     for split_name, split_info in split_dict.items():
          # dataset_name field is deprecated, and is therefore not part of the YAML dump
          _a			      =							None
          # the split name of split_dict takes over the name of the split info object
          _a			      =							split_name
     assert split_dict == reloaded






@pytest.mark.parametrize(
    'split_info'				,						[SplitInfo(), SplitInfo(dataset_name=lowerCAmelCase__		), SplitInfo(dataset_name='my_dataset'		)]		)
def 	_A				(lowerCAmelCase__  :Optional[Any]		)   ->  List[str]:




     '''simple docstring'''



     _a			      =							asdict(SplitDict({'train': split_info}		)		)
     assert "dataset_name" in split_dict_asdict["train"]
     assert split_dict_asdict["train"]["dataset_name"] == split_info.dataset_name





'''simple docstring'''






class  a     :
 def __init__( self						)					->							List[Any]:
      _a			      =							''
      _a			      =							''
      _a			      =							[]
 def 							__UpperCAmelCase		( self      ,				__magic_name__      ,				__magic_name__						)					->							int:
      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]:
                _a			      =							self.__min_dist_top_down_dp(m - 1      ,				n - 1						)
           else:
                _a			      =							self.__min_dist_top_down_dp(__magic_name__      ,				n - 1						)
                _a			      =							self.__min_dist_top_down_dp(m - 1      ,				__magic_name__						)
                _a			      =							self.__min_dist_top_down_dp(m - 1      ,				n - 1						)
                _a			      =							1 + min(__magic_name__      ,				__magic_name__      ,				__magic_name__						)

           return self.dp[m][n]
 def 							__UpperCAmelCase		( self      ,				__magic_name__      ,				__magic_name__						)					->							int:
      _a			      =							worda
      _a			      =							worda
      _a			      =							[[-1 for _ in range(len(__magic_name__						)						)] for _ in range(len(__magic_name__						)						)]

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




 def 							__UpperCAmelCase		( self      ,				__magic_name__      ,				__magic_name__						)					->							int:
      _a			      =							worda
      _a			      =							worda
      _a			      =							len(__magic_name__						)
      _a			      =							len(__magic_name__						)
      _a			      =							[[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
                     _a			      =							j
                elif j == 0:  # second string is empty
                     _a			      =							i
                elif worda[i - 1] == worda[j - 1]:  # last characters are equal
                     _a			      =							self.dp[i - 1][j - 1]
                else:
                     _a			      =							self.dp[i][j - 1]
                     _a			      =							self.dp[i - 1][j]
                     _a			      =							self.dp[i - 1][j - 1]
                     _a			      =							1 + min(__magic_name__      ,				__magic_name__      ,				__magic_name__						)
      return self.dp[m][n]


if __name__ == "__main__":
 a_					:    Dict          =    EditDistance()

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

 a_					:    Tuple          =    input("Enter the first string: ").strip()
 a_					:    Dict          =    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 ***************")

