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 and return the frequent substrings (n-grams) from the provided data.
  
  Starting from the n-grams of length `self.min_ngram_length`, the method extracts
  and computes the frequencies of n-grams iteratively. For each iteration,
  it filters the data to only include samples that contain the frequent n-grams
  identified in that iteration. The process continues by increasing the n-gram length
  until no frequent n-grams are identified in an iteration.
  
  Parameters:
  -----------
  data : list of tuple
      The dataset from which to extract n-grams. Each tuple consists of
      an original index and a text string.
  
  Returns:
  --------
  dict
      A dictionary where keys are frequent n-grams and values are another dictionary
      containing frequency ('freq') and original indexes ('original_indexes') of the n-gram.
  
  Notes:
  ------
  The method relies on `self._calculate_ngram_frequencies` to compute the
  frequencies of n-grams and identify the frequent ones.
docstr_tok: ["Identify","and","return","the","frequent","substrings","(","n-grams",")","from","the","provided","data",".","Starting","from","the","n-grams","of","length","`","self.min_ngram_length","`",",","the","method","extracts","and","computes","the","frequencies","of","n-grams","iteratively",".","For","each","iteration",",","it","filters","the","data","to","only","include","samples","that","contain","the","frequent","n-grams","identified","in","that","iteration",".","The","process","continues","by","increasing","the","n-gram","length","until","no","frequent","n-grams","are","identified","in","an","iteration",".","Parameters",":","--","--","--","--","--","-","data",":","list","of","tuple","The","dataset","from","which","to","extract","n-grams",".","Each","tuple","consists","of","an","original","index","and","a","text","string",".","Returns",":","--","--","--","--","dict","A","dictionary","where","keys","are","frequent","n-grams","and","values","are","another","dictionary","containing","frequency","(","'freq","'",")","and","original","indexes","(","'original_indexes","'",")","of","the","n-gram",".","Notes",":","--","--","--","The","method","relies","on","`","self._calculate_ngram_frequencies","`","to","compute","the","frequencies","of","n-grams","and","identify","the","frequent","ones","."]
code: def _find_frequent_substrings(self, data):
      """
      Identify and return the frequent substrings (n-grams) from the provided data.
  
      Starting from the n-grams of length `self.min_ngram_length`, the method extracts
      and computes the frequencies of n-grams iteratively. For each iteration,
      it filters the data to only include samples that contain the frequent n-grams
      identified in that iteration. The process continues by increasing the n-gram length
      until no frequent n-grams are identified in an iteration.
  
      Parameters:
      -----------
      data : list of tuple
          The dataset from which to extract n-grams. Each tuple consists of
          an original index and a text string.
  
      Returns:
      --------
      dict
          A dictionary where keys are frequent n-grams and values are another dictionary
          containing frequency ('freq') and original indexes ('original_indexes') of the n-gram.
  
      Notes:
      ------
      The method relies on `self._calculate_ngram_frequencies` to compute the
      frequencies of n-grams and identify the frequent ones.
      """
      n = self.min_ngram_length
      final_results = {}
      num_samples = len(data)
      while data:
          (
              ngram_info,
              filtered_samples,
          ) = self._calculate_ngram_frequencies(data, n, num_samples)
          final_results.update(ngram_info)
          if len(filtered_samples) == 0:
              return final_results
          data = [data[i] for i in filtered_samples]
          n += 1
  
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 6 for calling the FrequentSubstrings obj's underlying member method code with example usage: obj._find_frequent_substrings(data) and returns: final_results