class_docstr: Checks for frequent substrings in the dataset.
  
  Substrings of varying lengths (n-grams) are extracted from the dataset text samples.
  The frequencies of these n-grams are calculated and only substrings exceeding a defined minimum length are retained.
  The substrings are then sorted by their frequencies and the most frequent substrings are identified.
  Finally, the substrings with the highest frequency and those surpassing a significance level are displayed.
  
  Parameters
  ----------
  n_to_show : int, default: 5
      Number of most frequent substrings to show.
  n_samples : int, default: 10_000
      Number of samples to use for this check.
  random_state : int, default: 42
      Random seed for all check internals.
  n_sentences : int, default: 5
      The number of sentences to extract from the beginning and end of the text content.
  min_ngram_length: int, default: 4
      Minimum amount of words for a substring to be considered a frequent substring.
  min_substring_ratio: float, default: 0.05
      Minimum frequency required for a substring to be considered "frequent".
  significant_substring_ratio: float, default: 0.3
      Frequency above which samples are considered significant. Substrings
      meeting or exceeding this ratio will always be returned, regardless of
      other parameters and conditions.
  frequency_margin: float, default: 0.02
      Defines the tolerance level for selecting longer overlapping substrings. If a longer substring
      has a frequency that's less than a shorter overlapping substring but the difference is within
      the specified frequency_margin, the longer substring is still preferred.
  min_relative_change : float, optional, default=0.05
      Defines the threshold for relative change. If the computed relative
      change falls below this specified threshold, it is
      considered insignificant and is thus set to zero.
class_docstr_tok: ["Checks","for","frequent","substrings","in","the","dataset",".","Substrings","of","varying","lengths","(","n-grams",")","are","extracted","from","the","dataset","text","samples",".","The","frequencies","of","these","n-grams","are","calculated","and","only","substrings","exceeding","a","defined","minimum","length","are","retained",".","The","substrings","are","then","sorted","by","their","frequencies","and","the","most","frequent","substrings","are","identified",".","Finally",",","the","substrings","with","the","highest","frequency","and","those","surpassing","a","significance","level","are","displayed",".","Parameters","--","--","--","--","--","n_to_show",":","int",",","default",":","5","Number","of","most","frequent","substrings","to","show",".","n_samples",":","int",",","default",":","10_000","Number","of","samples","to","use","for","this","check",".","random_state",":","int",",","default",":","42","Random","seed","for","all","check","internals",".","n_sentences",":","int",",","default",":","5","The","number","of","sentences","to","extract","from","the","beginning","and","end","of","the","text","content",".","min_ngram_length",":","int",",","default",":","4","Minimum","amount","of","words","for","a","substring","to","be","considered","a","frequent","substring",".","min_substring_ratio",":","float",",","default",":","0.05","Minimum","frequency","required","for","a","substring","to","be","considered","``","frequent","''",".","significant_substring_ratio",":","float",",","default",":","0.3","Frequency","above","which","samples","are","considered","significant",".","Substrings","meeting","or","exceeding","this","ratio","will","always","be","returned",",","regardless","of","other","parameters","and","conditions",".","frequency_margin",":","float",",","default",":","0.02","Defines","the","tolerance","level","for","selecting","longer","overlapping","substrings",".","If","a","longer","substring","has","a","frequency","that","'s","less","than","a","shorter","overlapping","substring","but","the","difference","is","within","the","specified","frequency_margin",",","the","longer","substring","is","still","preferred",".","min_relative_change",":","float",",","optional",",","default=0.05","Defines","the","threshold","for","relative","change",".","If","the","computed","relative","change","falls","below","this","specified","threshold",",","it","is","considered","insignificant","and","is","thus","set","to","zero","."]
docstr: Identify the index at which there's a maximum relative change (peak) in the 'Frequency' column.
  
  The function calculates the absolute difference between consecutive values in the 'Frequency' column
  and divides this by the previous row's value to find the relative change or ratio. If the relative
  change is below a certain threshold (`self.min_relative_change`), it is set to zero. The index of the maximum
  relative change (peak) is returned.
  
  Parameters
  ----------
  df : pd.DataFrame
      Input dataframe with a 'Frequency' column.
  
  Returns
  -------
  int
      The index of the maximum relative change in the 'Frequency' column. If no significant peak is
      found, returns the length of the dataframe.
docstr_tok: ["Identify","the","index","at","which","there","'s","a","maximum","relative","change","(","peak",")","in","the","'Frequency","'","column",".","The","function","calculates","the","absolute","difference","between","consecutive","values","in","the","'Frequency","'","column","and","divides","this","by","the","previous","row","'s","value","to","find","the","relative","change","or","ratio",".","If","the","relative","change","is","below","a","certain","threshold","(","`","self.min_relative_change","`",")",",","it","is","set","to","zero",".","The","index","of","the","maximum","relative","change","(","peak",")","is","returned",".","Parameters","--","--","--","--","--","df",":","pd.DataFrame","Input","dataframe","with","a","'Frequency","'","column",".","Returns","--","--","--","-","int","The","index","of","the","maximum","relative","change","in","the","'Frequency","'","column",".","If","no","significant","peak","is","found",",","returns","the","length","of","the","dataframe","."]
code: def _identify_peak_cut(self, df):
      """
      Identify the index at which there's a maximum relative change (peak) in the 'Frequency' column.
  
      The function calculates the absolute difference between consecutive values in the 'Frequency' column
      and divides this by the previous row's value to find the relative change or ratio. If the relative
      change is below a certain threshold (`self.min_relative_change`), it is set to zero. The index of the maximum
      relative change (peak) is returned.
  
      Parameters
      ----------
      df : pd.DataFrame
          Input dataframe with a 'Frequency' column.
  
      Returns
      -------
      int
          The index of the maximum relative change in the 'Frequency' column. If no significant peak is
          found, returns the length of the dataframe.
      """
      diff = df["Frequency"].diff().abs()
      ratio = diff.div(df["Frequency"].shift(1))
      ratio[ratio <= self.min_relative_change] = 0
      max_peak = ratio.max()
      if max_peak == 0:
          return len(df)
      return list(ratio[ratio == max_peak].index)[0]
  
imports: import re
  from collections import defaultdict
  from typing import Dict
  import pandas
  from deepchecks.core import CheckResult, ConditionCategory, ConditionResult
  from deepchecks.core.errors import DeepchecksValueError
  from deepchecks.nlp import Context, SingleDatasetCheck
  from deepchecks.utils.strings import format_percent
label_desc: Use image node_id 9 for calling the FrequentSubstrings obj's underlying member method code with example usage: obj._identify_peak_cut(df) and returns: list, len