def       A__   (						snake_case_			:		Tuple							,					snake_case_			:		Union[str, Any]							,					snake_case_			:		str=False   ):

 if isinstance(snake_case_							,					snake_case_   ) and isinstance(snake_case_							,					snake_case_   ):
  SCREAMING_SNAKE_CASE__: int=   len(set_a.intersection(snake_case_   )   )

  if alternative_union:
   SCREAMING_SNAKE_CASE__: int=   len(snake_case_   ) + len(snake_case_   )
  else:
   SCREAMING_SNAKE_CASE__: str=   len(set_a.union(snake_case_   )   )

  return intersection / union

 if isinstance(snake_case_							,					(list, tuple)   ) and isinstance(snake_case_							,					(list, tuple)   ):
  SCREAMING_SNAKE_CASE__: Any=   [element for element in set_a if element in set_b]

  if alternative_union:
   SCREAMING_SNAKE_CASE__: List[str]=   len(snake_case_   ) + len(snake_case_   )
   return len(snake_case_   ) / union
  else:
   SCREAMING_SNAKE_CASE__: Optional[int]=   set_a + [element for element in set_b if element not in set_a]
   return len(snake_case_   ) / len(snake_case_   )

  return len(snake_case_   ) / len(snake_case_   )
 return None


if __name__ == "__main__":
      lowercase_  : Any								=					{'a', 'b', 'c', 'd', 'e'}
      lowercase_  : Optional[Any]								=					{'c', 'd', 'e', 'f', 'h', 'i'}
      print(jaccard_similarity(set_a, set_b))









"""simple docstring"""


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


__SCREAMING_SNAKE_CASE   =   {
    'configuration_transfo_xl': ['TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TransfoXLConfig'],
    'tokenization_transfo_xl': ['TransfoXLCorpus', 'TransfoXLTokenizer'],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__SCREAMING_SNAKE_CASE   =   [
		    'TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'AdaptiveEmbedding',
		    'TransfoXLForSequenceClassification',
		    'TransfoXLLMHeadModel',
		    'TransfoXLModel',
		    'TransfoXLPreTrainedModel',
		    'load_tf_weights_in_transfo_xl',
		]

try:
		if not is_tf_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__SCREAMING_SNAKE_CASE   =   [
		    'TF_TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'TFAdaptiveEmbedding',
		    'TFTransfoXLForSequenceClassification',
		    'TFTransfoXLLMHeadModel',
		    'TFTransfoXLMainLayer',
		    'TFTransfoXLModel',
		    'TFTransfoXLPreTrainedModel',
		]


if TYPE_CHECKING:
		from .configuration_transfo_xl import TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP, TransfoXLConfig
		from .tokenization_transfo_xl import TransfoXLCorpus, TransfoXLTokenizer

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_transfo_xl import (
				    TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST,
				    AdaptiveEmbedding,
				    TransfoXLForSequenceClassification,
				    TransfoXLLMHeadModel,
				    TransfoXLModel,
				    TransfoXLPreTrainedModel,
				    load_tf_weights_in_transfo_xl,
				)

		try:
				if not is_tf_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_tf_transfo_xl import (
				    TF_TRANSFO_XL_PRETRAINED_MODEL_ARCHIVE_LIST,
				    TFAdaptiveEmbedding,
				    TFTransfoXLForSequenceClassification,
				    TFTransfoXLLMHeadModel,
				    TFTransfoXLMainLayer,
				    TFTransfoXLModel,
				    TFTransfoXLPreTrainedModel,
				)

else:
		import sys

		__SCREAMING_SNAKE_CASE   =   _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)