





'''simple docstring'''






from typing import Optional, Union

from ...file_utils import TensorType
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, TruncationStrategy




class 				UpperCAmelCase  (    __lowerCamelCase     ):
						_lowercase:    int		  =     '''MarkupLMFeatureExtractor'''
						_lowercase:    Union[str, Any]		  =     ('''MarkupLMTokenizer''', '''MarkupLMTokenizerFast''')
						_lowercase:    Optional[Any]		  =     True




						def __call__(    self    :				Optional[int]    ,    __snake_case    :				Dict=None    ,    __snake_case    :				List[str]=None    ,    __snake_case    :				Optional[Any]=None    ,    __snake_case    :				Dict=None    ,    __snake_case    :				int=None    ,    __snake_case    :				Tuple = True    ,    __snake_case    :				Union[str, Any] = False    ,    __snake_case    :				str = None    ,    __snake_case    :				Any = None    ,    __snake_case    :				List[Any] = 0    ,    __snake_case    :				str = None    ,    __snake_case    :				Optional[Any] = None    ,    __snake_case    :				Optional[Any] = None    ,    __snake_case    :				Optional[Any] = False    ,    __snake_case    :				Optional[Any] = False    ,    __snake_case    :				int = False    ,    __snake_case    :				Union[str, Any] = False    ,    __snake_case    :				Optional[int] = True    ,    __snake_case    :				str = None    ,    **__snake_case    :				int    ,    )       ->   List[str]:
												# first, create nodes and xpaths
												if self.parse_html:
																		if html_strings is None:
																								raise ValueError("""Make sure to pass HTML strings in case `parse_html` is set to `True`"""						)

																		if nodes is not None or xpaths is not None or node_labels is not None:
																								raise ValueError(
																								    """Please don't pass nodes, xpaths nor node labels in case `parse_html` is set to `True`"""						)

																		_lowerCAmelCase							  =							self.feature_extractor(_lowerCAmelCase						)
																		_lowerCAmelCase							  =							features["""nodes"""]
																		_lowerCAmelCase							  =							features["""xpaths"""]
												else:
																		if html_strings is not None:
																								raise ValueError("""You have passed HTML strings but `parse_html` is set to `False`."""						)
																		if nodes is None or xpaths is None:
																								raise ValueError("""Make sure to pass nodes and xpaths in case `parse_html` is set to `False`"""						)

        # # second, apply the tokenizer
												if questions is not None and self.parse_html:
																		if isinstance(_lowerCAmelCase    ,    _lowerCAmelCase						):
																								_lowerCAmelCase							  =							[questions]  # add batch dimension (as the feature extractor always adds a batch dimension)

												_lowerCAmelCase							  =							self.tokenizer(
												    text=questions if questions is not None else nodes    ,    text_pair=nodes if questions is not None else None    ,    xpaths=_lowerCAmelCase    ,    node_labels=_lowerCAmelCase    ,    add_special_tokens=_lowerCAmelCase    ,    padding=_lowerCAmelCase    ,    truncation=_lowerCAmelCase    ,    max_length=_lowerCAmelCase    ,    stride=_lowerCAmelCase    ,    pad_to_multiple_of=_lowerCAmelCase    ,    return_token_type_ids=_lowerCAmelCase    ,    return_attention_mask=_lowerCAmelCase    ,    return_overflowing_tokens=_lowerCAmelCase    ,    return_special_tokens_mask=_lowerCAmelCase    ,    return_offsets_mapping=_lowerCAmelCase    ,    return_length=_lowerCAmelCase    ,    verbose=_lowerCAmelCase    ,    return_tensors=_lowerCAmelCase    ,    **_lowerCAmelCase    ,    )

												return encoded_inputs




						def        lowercase__					(    self    :				List[Any]    ,    *__snake_case    :				str    ,    **__snake_case    :				Any						)       ->   List[Any]:
												return self.tokenizer.batch_decode(*_lowerCAmelCase    ,    **_lowerCAmelCase						)




						def        lowercase__					(    self    :				List[str]    ,    *__snake_case    :				Tuple    ,    **__snake_case    :				str						)       ->   int:
												return self.tokenizer.decode(*_lowerCAmelCase    ,    **_lowerCAmelCase						)




						@property
						def        lowercase__					(    self    :				Optional[int]						)       ->   Optional[Any]:
												_lowerCAmelCase							  =							self.tokenizer.model_input_names
												return tokenizer_input_names













'''simple docstring'''






from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


A__       :     Tuple          ={
    '''configuration_mpnet''': ['''MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MPNetConfig'''],
    '''tokenization_mpnet''': ['''MPNetTokenizer'''],
}

try:
      if not is_tokenizers_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A__       :     Tuple          =['''MPNetTokenizerFast''']

try:
      if not is_torch_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A__       :     List[Any]          =[
          '''MPNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''MPNetForMaskedLM''',
          '''MPNetForMultipleChoice''',
          '''MPNetForQuestionAnswering''',
          '''MPNetForSequenceClassification''',
          '''MPNetForTokenClassification''',
          '''MPNetLayer''',
          '''MPNetModel''',
          '''MPNetPreTrainedModel''',
      ]

try:
      if not is_tf_available():
            raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
      pass
else:
      A__       :     str          =[
          '''TF_MPNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
          '''TFMPNetEmbeddings''',
          '''TFMPNetForMaskedLM''',
          '''TFMPNetForMultipleChoice''',
          '''TFMPNetForQuestionAnswering''',
          '''TFMPNetForSequenceClassification''',
          '''TFMPNetForTokenClassification''',
          '''TFMPNetMainLayer''',
          '''TFMPNetModel''',
          '''TFMPNetPreTrainedModel''',
      ]


if TYPE_CHECKING:
      from .configuration_mpnet import MPNET_PRETRAINED_CONFIG_ARCHIVE_MAP, MPNetConfig
      from .tokenization_mpnet import MPNetTokenizer

      try:
            if not is_tokenizers_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .tokenization_mpnet_fast import MPNetTokenizerFast

      try:
            if not is_torch_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_mpnet import (
                MPNET_PRETRAINED_MODEL_ARCHIVE_LIST,
                MPNetForMaskedLM,
                MPNetForMultipleChoice,
                MPNetForQuestionAnswering,
                MPNetForSequenceClassification,
                MPNetForTokenClassification,
                MPNetLayer,
                MPNetModel,
                MPNetPreTrainedModel,
            )

      try:
            if not is_tf_available():
                  raise OptionalDependencyNotAvailable()
      except OptionalDependencyNotAvailable:
            pass
      else:
            from .modeling_tf_mpnet import (
                TF_MPNET_PRETRAINED_MODEL_ARCHIVE_LIST,
                TFMPNetEmbeddings,
                TFMPNetForMaskedLM,
                TFMPNetForMultipleChoice,
                TFMPNetForQuestionAnswering,
                TFMPNetForSequenceClassification,
                TFMPNetForTokenClassification,
                TFMPNetMainLayer,
                TFMPNetModel,
                TFMPNetPreTrainedModel,
            )

else:
      import sys

      A__       :     List[Any]          =_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






