


'''simple docstring'''


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_UpperCamelCase 							=  {
    """configuration_clipseg""": [
        """CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """CLIPSegConfig""",
        """CLIPSegTextConfig""",
        """CLIPSegVisionConfig""",
    ],
    """processing_clipseg""": ["""CLIPSegProcessor"""],
}

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      _UpperCamelCase 							=  [
          """CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST""",
          """CLIPSegModel""",
          """CLIPSegPreTrainedModel""",
          """CLIPSegTextModel""",
          """CLIPSegVisionModel""",
          """CLIPSegForImageSegmentation""",
      ]

if TYPE_CHECKING:
      from .configuration_clipseg import (
          CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP,
          CLIPSegConfig,
          CLIPSegTextConfig,
          CLIPSegVisionConfig,
      )
      from .processing_clipseg import CLIPSegProcessor

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_clipseg import (
                CLIPSEG_PRETRAINED_MODEL_ARCHIVE_LIST,
                CLIPSegForImageSegmentation,
                CLIPSegModel,
                CLIPSegPreTrainedModel,
                CLIPSegTextModel,
                CLIPSegVisionModel,
            )

else:
      import sys

      _UpperCamelCase 							=  _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)





'''simple docstring'''


import functools


def 		_lowercase (SCREAMING_SNAKE_CASE       ,					SCREAMING_SNAKE_CASE							):




     '''simple docstring'''





     __A	:       int      =							len(SCREAMING_SNAKE_CASE							)
     __A	:       int      =							len(SCREAMING_SNAKE_CASE							)

     @functools.cache
     def min_distance(SCREAMING_SNAKE_CASE       ,					SCREAMING_SNAKE_CASE							) -> int:
          # if first word index is overflow - delete all from the second word
          if indexa >= len_worda:
               return len_worda - indexa
          # if second word index is overflow - delete all from the first word
          if indexa >= len_worda:
               return len_worda - indexa
          __A	:       Optional[int]      =							int(worda[indexa] != worda[indexa]							)  # current letters not identical
          return min(
              1 + min_distance(indexa + 1       ,					SCREAMING_SNAKE_CASE							)       ,					1 + min_distance(SCREAMING_SNAKE_CASE       ,					indexa + 1							)       ,					diff + min_distance(indexa + 1       ,					indexa + 1							)       ,					)

     return min_distance(0       ,					0							)


if __name__ == "__main__":
      import doctest

      doctest.testmod()

