
"""simple docstring"""

def 						UpperCAmelCase   (						a_,		a_,		a_,		a_     ):





		'''simple docstring'''


		return len_board * len_board_column * row + column
def 						UpperCAmelCase   (						a_,		a_,		a_,		a_,		a_,		a_,		):





		'''simple docstring'''


		if board[row][column] != word[word_index]:
				return False

		if word_index == len(_A     ) - 1:
				return True

		lowerCamelCase	:     Union[str, Any]            =       [(0, 1), (0, -1), (-1, 0), (1, 0)]
		lowerCamelCase	:     Optional[Any]            =       len(_A     )
		lowerCamelCase	:     Optional[Any]            =       len(board[0]     )
		for direction in traverts_directions:
				lowerCamelCase	:     Optional[int]            =       row + direction[0]
				lowerCamelCase	:     List[str]            =       column + direction[1]
				if not (0 <= next_i < len_board and 0 <= next_j < len_board_column):
						continue

				lowerCamelCase	:     Optional[Any]            =       get_point_key(_A,		_A,		_A,		_A     )
				if key in visited_points_set:
						continue

				visited_points_set.add(_A     )
				if exits_word(_A,		_A,		_A,		_A,		word_index + 1,		_A     ):
						return True

				visited_points_set.remove(_A     )

		return False
def 						UpperCAmelCase   (						a_,		a_     ):





		'''simple docstring'''


		lowerCamelCase	:     Optional[int]            =       (
		    """The board should be a non empty matrix of single chars strings."""
		)

		lowerCamelCase	:     List[str]            =       len(_A     )
		if not isinstance(_A,		_A     ) or len(_A     ) == 0:
				raise ValueError(_A     )

		for row in board:
				if not isinstance(_A,		_A     ) or len(_A     ) == 0:
						raise ValueError(_A     )

				for item in row:
						if not isinstance(_A,		_A     ) or len(_A     ) != 1:
								raise ValueError(_A     )

    # Validate word
		if not isinstance(_A,		_A     ) or len(_A     ) == 0:
				raise ValueError(
				    'The word parameter should be a string of length greater than 0.'     )

		lowerCamelCase	:     str            =       len(board[0]     )
		for i in range(_A     ):
				for j in range(_A     ):
						if exits_word(
						    _A,		_A,		_A,		_A,		0,		{get_point_key(_A,		_A,		_A,		_A     )}     ):
								return True

		return False


if __name__ == "__main__":
					import doctest

					doctest.testmod()









from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_speech_available,
    is_torch_available,
)


UpperCAmelCase__			:  Tuple					     =     {
    """configuration_speech_to_text_2""": ["""SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Speech2Text2Config"""],
    """processing_speech_to_text_2""": ["""Speech2Text2Processor"""],
    """tokenization_speech_to_text_2""": ["""Speech2Text2Tokenizer"""],
}


try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase__			:  Tuple					     =     [
      """SPEECH_TO_TEXT_2_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """Speech2Text2ForCausalLM""",
      """Speech2Text2PreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_speech_to_text_a import SPEECH_TO_TEXT_2_PRETRAINED_CONFIG_ARCHIVE_MAP, SpeechaTextaConfig
  from .processing_speech_to_text_a import SpeechaTextaProcessor
  from .tokenization_speech_to_text_a import SpeechaTextaTokenizer

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_speech_to_text_a import (
        SPEECH_TO_TEXT_2_PRETRAINED_MODEL_ARCHIVE_LIST,
        SpeechaTextaForCausalLM,
        SpeechaTextaPreTrainedModel,
    )

else:
  import sys

  UpperCAmelCase__			:  Optional[int]					     =     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)




