class_docstr: KeywordProcessor
  
  Attributes:
      _keyword (str): Used as key to store keywords in trie dictionary.
          Defaults to '_keyword_'
      non_word_boundaries (set(str)): Characters that will determine if the word is continuing.
          Defaults to set([A-Za-z0-9_])
      keyword_trie_dict (dict): Trie dict built character by character, that is used for lookup
          Defaults to empty dictionary
      case_sensitive (boolean): if the search algorithm should be case sensitive or not.
          Defaults to False
  
  Examples:
      >>> # import module
      >>> from flashtext import KeywordProcessor
      >>> # Create an object of KeywordProcessor
      >>> keyword_processor = KeywordProcessor()
      >>> # add keywords
      >>> keyword_names = ['NY', 'new-york', 'SF']
      >>> clean_names = ['new york', 'new york', 'san francisco']
      >>> for keyword_name, clean_name in zip(keyword_names, clean_names):
      >>>     keyword_processor.add_keyword(keyword_name, clean_name)
      >>> keywords_found = keyword_processor.extract_keywords('I love SF and NY. new-york is the best.')
      >>> keywords_found
      >>> ['san francisco', 'new york', 'new york']
  
  Note:
      * loosely based on `Aho-Corasick algorithm <https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm>`_.
      * Idea came from this `Stack Overflow Question <https://stackoverflow.com/questions/44178449/regex-replace-is-taking-time-for-millions-of-documents-how-to-make-it-faster>`_.
class_docstr_tok: ["KeywordProcessor","Attributes",":","_keyword","(","str",")",":","Used","as","key","to","store","keywords","in","trie","dictionary",".","Defaults","to","'_keyword_'","non_word_boundaries","(","set","(","str",")",")",":","Characters","that","will","determine","if","the","word","is","continuing",".","Defaults","to","set","(","[","A-Za-z0-9_","]",")","keyword_trie_dict","(","dict",")",":","Trie","dict","built","character","by","character",",","that","is","used","for","lookup","Defaults","to","empty","dictionary","case_sensitive","(","boolean",")",":","if","the","search","algorithm","should","be","case","sensitive","or","not",".","Defaults","to","False","Examples",":",">",">",">","#","import","module",">",">",">","from","flashtext","import","KeywordProcessor",">",">",">","#","Create","an","object","of","KeywordProcessor",">",">",">","keyword_processor","=","KeywordProcessor","(",")",">",">",">","#","add","keywords",">",">",">","keyword_names","=","[","'NY","'",",","'new-york","'",",","'SF","'","]",">",">",">","clean_names","=","[","'new","york","'",",","'new","york","'",",","'san","francisco","'","]",">",">",">","for","keyword_name",",","clean_name","in","zip","(","keyword_names",",","clean_names",")",":",">",">",">","keyword_processor.add_keyword","(","keyword_name",",","clean_name",")",">",">",">","keywords_found","=","keyword_processor.extract_keywords","(","'","I","love","SF","and","NY",".","new-york","is","the","best",".","'",")",">",">",">","keywords_found",">",">",">","[","'san","francisco","'",",","'new","york","'",",","'new","york","'","]","Note",":","*","loosely","based","on","`","Aho-Corasick","algorithm","<","https",":","\/\/en.wikipedia.org\/wiki\/Aho","%","E2","%","80","%","93Corasick_algorithm",">","`","_",".","*","Idea","came","from","this","`","Stack","Overflow","Question","<","https",":","\/\/stackoverflow.com\/questions\/44178449\/regex-replace-is-taking-time-for-millions-of-documents-how-to-make-it-faster",">","`","_","."]
code: def _levenshtein_rec(self, char, node, word, rows, max_cost, depth=0):
      n_columns = len(word) + 1
      new_rows = [rows[0] + 1]
      cost = 0
  
      for col in range(1, n_columns):
          insert_cost = new_rows[col - 1] + 1
          delete_cost = rows[col] + 1
          replace_cost = rows[col - 1] + int(word[col - 1] != char)
          cost = min((insert_cost, delete_cost, replace_cost))
          new_rows.append(cost)
  
      stop_crit = isinstance(node, dict) and node.keys() & (
          self._white_space_chars | {self._keyword}
      )
      if new_rows[-1] <= max_cost and stop_crit:
          yield node, cost, depth
  
      elif isinstance(node, dict) and min(new_rows) <= max_cost:
          for new_char, new_node in node.items():
              yield from self._levenshtein_rec(
                  new_char,
                  new_node,
                  word,
                  new_rows,
                  max_cost,
                  depth=depth + 1,
              )
  
imports: import os
  import string
  import io
label_desc: Use image node_id 23 for calling the KeywordProcessor obj's underlying member method code with example usage: obj._levenshtein_rec(char, node, word, rows, max_cost, depth) without return types