class_docstr: Find samples that contain special characters and also the most common special characters in the dataset.
  
  Parameters
  ----------
  special_characters_allow_list: Union[str, Sequence[str]] , default ' ' + string.punctuation
      set of special characters to ignore. Punctuation (string.punctuation) is whitelisted by default.
  max_samples_to_show : int , default: 5
      Maximum number of most common special-only samples to show in the display.
  max_special_chars_to_show : int , default: 5
      Maximum number of most common special characters per sample to show in the display.
  max_chars_to_review_per_sample : int , default: 10000
      Maximal number of characters to sample randomly from each text sample.
  n_samples: int, default: 10_000_000
      number of samples to use for this check.
  random_state : int, default: 42
      random seed for all check internals.
  {max_text_length_for_display_param:1*indent}
class_docstr_tok: ["Find","samples","that","contain","special","characters","and","also","the","most","common","special","characters","in","the","dataset",".","Parameters","--","--","--","--","--","special_characters_allow_list",":","Union","[","str",",","Sequence","[","str","]","]",",","default","'","'","+","string.punctuation","set","of","special","characters","to","ignore",".","Punctuation","(","string.punctuation",")","is","whitelisted","by","default",".","max_samples_to_show",":","int",",","default",":","5","Maximum","number","of","most","common","special-only","samples","to","show","in","the","display",".","max_special_chars_to_show",":","int",",","default",":","5","Maximum","number","of","most","common","special","characters","per","sample","to","show","in","the","display",".","max_chars_to_review_per_sample",":","int",",","default",":","10000","Maximal","number","of","characters","to","sample","randomly","from","each","text","sample",".","n_samples",":","int",",","default",":","10_000_000","number","of","samples","to","use","for","this","check",".","random_state",":","int",",","default",":","42","random","seed","for","all","check","internals",".","{","max_text_length_for_display_param:1","*","indent","}"]
docstr: Add condition - ratio of samples containing more special characters than threshold is below max_ratio.
  
  Parameters
  ----------
  max_ratio : float , default: 0.05
      Maximum ratio of samples allowed.
  threshold_ratio_per_sample : float , default: 0.2
      Threshold ratio of special characters in a sample.
docstr_tok: ["Add","condition","-","ratio","of","samples","containing","more","special","characters","than","threshold","is","below","max_ratio",".","Parameters","--","--","--","--","--","max_ratio",":","float",",","default",":","0.05","Maximum","ratio","of","samples","allowed",".","threshold_ratio_per_sample",":","float",",","default",":","0.2","Threshold","ratio","of","special","characters","in","a","sample","."]
code: def add_condition_samples_ratio_w_special_characters_less_or_equal(
      self: Self,
      max_ratio: float = 0.05,
      threshold_ratio_per_sample=0.2,
  ) -> Self:
      """Add condition - ratio of samples containing more special characters than threshold is below max_ratio.
  
      Parameters
      ----------
      max_ratio : float , default: 0.05
          Maximum ratio of samples allowed.
      threshold_ratio_per_sample : float , default: 0.2
          Threshold ratio of special characters in a sample.
      """
      name = (
          f"Ratio of samples containing more than {format_percent(threshold_ratio_per_sample)} "
          f"special characters is below {format_percent(max_ratio)}"
      )
  
      def condition(result: t.Dict[str, t.Any]):
          percents_arr = np.asarray(
              result["percent_special_chars_per_sample"]
          )
          n_samples_above_threshold = len(
              percents_arr[percents_arr > threshold_ratio_per_sample]
          )
          if n_samples_above_threshold / len(percents_arr) > max_ratio:
              return ConditionResult(
                  ConditionCategory.FAIL,
                  f"Found {n_samples_above_threshold} samples with special char ratio above threshold",
              )
          else:
              return ConditionResult(
                  ConditionCategory.PASS,
                  f"Found {n_samples_above_threshold} samples with special char ratio above threshold",
              )
  
      return self.add_condition(name, condition)
  
imports: import random
  import string
  import typing
  from collections import Counter
  import numpy
  import pandas
  from typing_extensions import Self, TypedDict
  from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
  from deepchecks.core.errors import DeepchecksValueError
  from deepchecks.nlp import Context, SingleDatasetCheck
  from deepchecks.nlp._shared_docs import docstrings
  from deepchecks.nlp.text_data import TextData
  from deepchecks.utils.dataframes import hide_index_for_display
  from deepchecks.utils.strings import SPECIAL_CHARACTERS, format_percent
label_desc: Use image node_id 3 for calling the SpecialCharacters obj's underlying member method code with example usage: obj.add_condition_samples_ratio_w_special_characters_less_or_equal(max_ratio, threshold_ratio_per_sample) and returns: self, ConditionResult, ConditionResult