'''simple docstring'''

from ...processing_utils import ProcessorMixin





class 							lowercase						(						__lowerCamelCase ):
   lowerCamelCase_    					='WhisperFeatureExtractor'
   lowerCamelCase_    					='WhisperTokenizer'


   def __init__(   self				:	List[str]   ,		__lowerCAmelCase				:	int   ,		__lowerCAmelCase				:	int)      ->					Optional[int]:
         super().__init__(__lowerCAmelCase   ,		__lowerCAmelCase)
         lowercase_     =      self.feature_extractor
         lowercase_     =      False


   def __UpperCAmelCase       (   self				:	int   ,		__lowerCAmelCase				:	Any=None   ,		__lowerCAmelCase				:	str=None   ,		__lowerCAmelCase				:	Optional[int]=True)      ->					Dict:
         return self.tokenizer.get_decoder_prompt_ids(task=__lowerCAmelCase   ,		language=__lowerCAmelCase   ,		no_timestamps=__lowerCAmelCase)


   def __call__(   self				:	Any   ,		*__lowerCAmelCase				:	List[Any]   ,		**__lowerCAmelCase				:	List[Any])      ->					Union[str, Any]:
         # For backward compatibility
         if self._in_target_context_manager:
               return self.current_processor(*__lowerCAmelCase   ,		**__lowerCAmelCase)

         lowercase_     =      kwargs.pop("audio"   ,		__lowerCAmelCase)
         lowercase_     =      kwargs.pop("sampling_rate"   ,		__lowerCAmelCase)
         lowercase_     =      kwargs.pop("text"   ,		__lowerCAmelCase)
         if len(__lowerCAmelCase) > 0:
               lowercase_     =      args[0]
               lowercase_     =      args[1:]

         if audio is None and text is None:
               raise ValueError("You need to specify either an `audio` or `text` input to process.")

         if audio is not None:
               lowercase_     =      self.feature_extractor(__lowerCAmelCase   ,		*__lowerCAmelCase   ,		sampling_rate=__lowerCAmelCase   ,		**__lowerCAmelCase)
         if text is not None:
               lowercase_     =      self.tokenizer(__lowerCAmelCase   ,		**__lowerCAmelCase)

         if text is None:
               return inputs

         elif audio is None:
               return encodings
         else:
               lowercase_     =      encodings["input_ids"]
               return inputs


   def __UpperCAmelCase       (   self				:	Optional[Any]   ,		*__lowerCAmelCase				:	Optional[int]   ,		**__lowerCAmelCase				:	int)      ->					Optional[int]:
         return self.tokenizer.batch_decode(*__lowerCAmelCase   ,		**__lowerCAmelCase)


   def __UpperCAmelCase       (   self				:	str   ,		*__lowerCAmelCase				:	Dict   ,		**__lowerCAmelCase				:	List[str])      ->					int:
         return self.tokenizer.decode(*__lowerCAmelCase   ,		**__lowerCAmelCase)


   def __UpperCAmelCase       (   self				:	Optional[Any]   ,		__lowerCAmelCase				:	str   ,		__lowerCAmelCase				:	str="np")      ->					Dict:
         return self.tokenizer.get_prompt_ids(__lowerCAmelCase   ,		return_tensors=__lowerCAmelCase)







'''simple docstring'''

import functools
from typing import Any


def __a (	__lowerCamelCase			:						str ,		__lowerCamelCase			:						list[str]				)	->							bool:
      '''simple docstring'''


      if not isinstance(__lowerCamelCase ,		__lowerCamelCase				) or len(__lowerCamelCase				) == 0:
            raise ValueError("the string should be not empty string"				)

      if not isinstance(__lowerCamelCase ,		__lowerCamelCase				) or not all(
          isinstance(__lowerCamelCase ,		__lowerCamelCase				) and len(__lowerCamelCase				) > 0 for item in words				):
            raise ValueError("the words should be a list of non-empty strings"				)

      # Build trie
      lowercase_     =      {}
      lowercase_     =      "WORD_KEEPER"

      for word in words:
            lowercase_     =      trie
            for c in word:
                  if c not in trie_node:
                        lowercase_     =      {}

                  lowercase_     =      trie_node[c]

            lowercase_     =      True

      lowercase_     =      len(__lowerCamelCase				)

      # Dynamic programming method
      @functools.cache
      def is_breakable(__lowerCamelCase			:						int				) -> bool:
            if index == len_string:
                  return True

            lowercase_     =      trie
            for i in range(__lowerCamelCase ,		__lowerCamelCase				):
                  lowercase_     =      trie_node.get(string[i] ,		__lowerCamelCase				)

                  if trie_node is None:
                        return False

                  if trie_node.get(__lowerCamelCase ,		__lowerCamelCase				) and is_breakable(i + 1				):
                        return True

            return False

      return is_breakable(0				)


if __name__ == "__main__":
       import doctest

       doctest.testmod()






