class_docstr: Find outliers with respect to the given properties.
  
  The check finds outliers in the text properties.
  For numeric properties, the check uses `IQR <https://en.wikipedia.org/wiki/Interquartile_range#Outliers>`_ to
  detect outliers out of the single dimension properties.
  For categorical properties, the check searches for a relative "sharp drop" in values in order to detect outliers.
  
  Parameters
  ----------
  n_show_top : int , default : 5
      number of graphs to show (ordered from the property with the most outliers to the least)
  iqr_percentiles : Tuple[int, int] , default : (25, 75)
      Two percentiles which define the IQR range
  iqr_scale : float , default : 2
      The scale to multiply the IQR range for the outliers' detection
  sharp_drop_ratio : float, default : 0.9
      The size of the sharp drop to detect categorical outliers
  min_samples : int , default : 10
      Minimum number of samples required to calculate IQR. If there are not enough non-null samples for a specific
      property, the check will skip it. If all properties are skipped, the check will raise a NotEnoughSamplesError.
class_docstr_tok: ["Find","outliers","with","respect","to","the","given","properties",".","The","check","finds","outliers","in","the","text","properties",".","For","numeric","properties",",","the","check","uses","`","IQR","<","https",":","\/\/en.wikipedia.org\/wiki\/Interquartile_range","#","Outliers",">","`","_","to","detect","outliers","out","of","the","single","dimension","properties",".","For","categorical","properties",",","the","check","searches","for","a","relative","``","sharp","drop","''","in","values","in","order","to","detect","outliers",".","Parameters","--","--","--","--","--","n_show_top",":","int",",","default",":","5","number","of","graphs","to","show","(","ordered","from","the","property","with","the","most","outliers","to","the","least",")","iqr_percentiles",":","Tuple","[","int",",","int","]",",","default",":","(","25",",","75",")","Two","percentiles","which","define","the","IQR","range","iqr_scale",":","float",",","default",":","2","The","scale","to","multiply","the","IQR","range","for","the","outliers","'","detection","sharp_drop_ratio",":","float",",","default",":","0.9","The","size","of","the","sharp","drop","to","detect","categorical","outliers","min_samples",":","int",",","default",":","10","Minimum","number","of","samples","required","to","calculate","IQR",".","If","there","are","not","enough","non-null","samples","for","a","specific","property",",","the","check","will","skip","it",".","If","all","properties","are","skipped",",","the","check","will","raise","a","NotEnoughSamplesError","."]
docstr: Add condition - outlier ratio in every property is less or equal to ratio.
  
  Parameters
  ----------
  threshold : float , default: 0.05
      Maximum threshold of outliers ratio per property.
  properties_to_ignore : t.Optional[t.List[str]] , default: None
      List of properties to ignore for the condition.
docstr_tok: ["Add","condition","-","outlier","ratio","in","every","property","is","less","or","equal","to","ratio",".","Parameters","--","--","--","--","--","threshold",":","float",",","default",":","0.05","Maximum","threshold","of","outliers","ratio","per","property",".","properties_to_ignore",":","t.Optional","[","t.List","[","str","]","]",",","default",":","None","List","of","properties","to","ignore","for","the","condition","."]
code: def add_condition_outlier_ratio_less_or_equal(
      self: Self,
      threshold: float = 0.05,
      properties_to_ignore: t.Optional[t.List[str]] = None,
  ) -> Self:
      """Add condition - outlier ratio in every property is less or equal to ratio.
  
      Parameters
      ----------
      threshold : float , default: 0.05
          Maximum threshold of outliers ratio per property.
      properties_to_ignore : t.Optional[t.List[str]] , default: None
          List of properties to ignore for the condition.
      """
  
      def condition(result: t.Dict[str, t.Any]):
          failed_properties = []
          worst_property = ""
          worst_ratio = 0
  
          for property_name, info in result.items():
              if (
                  properties_to_ignore is not None
                  and property_name in properties_to_ignore
              ):
                  continue
              if isinstance(info, str):
                  continue
              if info["outlier_ratio"] > threshold:
                  failed_properties.append(property_name)
              if info["outlier_ratio"] > worst_ratio:
                  worst_property = property_name
                  worst_ratio = info["outlier_ratio"]
  
          if len(failed_properties) > 0:
              return ConditionResult(
                  ConditionCategory.FAIL,
                  f"Found {len(failed_properties)} properties with outlier ratios above threshold."
                  f"</br>Property with highest ratio is {worst_property} with outlier ratio of "
                  f"{format_percent(worst_ratio)}",
              )
          else:
              return ConditionResult(
                  ConditionCategory.PASS,
                  f"All properties have outlier ratios below threshold. "
                  f"Property with highest ratio is {worst_property} with outlier ratio of"
                  f" {format_percent(worst_ratio)}",
              )
  
      return self.add_condition(
          f"Outlier ratio in all properties is less or equal than {format_percent(threshold)}",
          condition,
      )
  
file_path: deepchecks/deepchecks/nlp/checks/data_integrity/text_property_outliers.py
imports: import typing
  import numpy
  import pandas
  from typing_extensions import Self
  from deepchecks import ConditionCategory, ConditionResult
  from deepchecks.core import CheckResult, DatasetKind
  from deepchecks.core.errors import DeepchecksValueError, NotEnoughSamplesError
  from deepchecks.nlp import Context, SingleDatasetCheck
  from deepchecks.nlp.utils.nlp_plot import get_text_outliers_graph
  from deepchecks.utils.dataframes import hide_index_for_display
  from deepchecks.utils.outliers import iqr_outliers_range, sharp_drop_outliers_range
  from deepchecks.utils.strings import format_percent
label_desc: Use image node_id 3 for calling the TextPropertyOutliers obj's underlying member method code with example usage: obj.add_condition_outlier_ratio_less_or_equal(threshold, properties_to_ignore) and returns: self, ConditionResult, ConditionResult