class_docstr: This analyzer class analyzes text data and calculates the TF-IDF, TF for the input corpus,
  and percentage of pre-defined patterns
docstr: Feed document text string to analyzer for stats analysis
  
  Args:
      doc: one document text string that will be analysed in the analyzer
docstr_tok: ["Feed","document","text","string","to","analyzer","for","stats","analysis","Args",":","doc",":","one","document","text","string","that","will","be","analysed","in","the","analyzer"]
code: def feed(self, doc):
      """
      Feed document text string to analyzer for stats analysis
  
      Args:
          doc: one document text string that will be analysed in the analyzer
      """
  
      tokens, pattern_counter, doc = self.preprocessor(doc)
  
      # update pattern count
      for pattern_name, pattern_count in pattern_counter.items():
          self._pattern_occurrence_counter[
              pattern_name
          ] += pattern_count
          if pattern_count > 0:
              self._pattern_document_counter[pattern_name] += 1
  
      # update word count and char count
      self._word_counter[len(tokens)] += 1
      self._character_counter[len(doc)] += 1
  
      # get tf per doc
      word_counter = Counter(tokens)
      for word in self.stop_words:
          del word_counter[word]
  
      if self.tf_type == TermFrequencyType.TF_ABSOLUTE:
          tf = word_counter
      elif self.tf_type == TermFrequencyType.TF_BOOLEAN:
          tf = Counter(word_counter.keys())
      elif self.tf_type == TermFrequencyType.TF_NORMALIZED_BY_MAX:
          max_tf = max(word_counter.values())
          tf = {w: f / max_tf for w, f in word_counter.items()}
      elif self.tf_type == TermFrequencyType.TF_NORMALIZED_BY_DOC:
          num_tokens = len(tokens)
          tf = {w: f / num_tokens for w, f in word_counter.items()}
      elif self.tf_type == TermFrequencyType.TF_LOGARITHM:
          tf = {w: math.log(1 + f) for w, f in word_counter.items()}
      elif self.tf_type == TermFrequencyType.TF_AUGMENTED:
          max_tf = max(word_counter.values())
          tf = {
              w: (0.5 + 0.5 * (f / max_tf))
              for w, f in word_counter.items()
          }
  
      # update tf and df
      self._term_frequency.update(tf)
      self._absolute_term_frequency.update(word_counter)
      self._document_frequency.update(word_counter.keys())
      self._total_count += 1
  
file_path: contextual-ai/xai/data/explorer/text/text_analyzer.py
imports: import math
  from collections import Counter
  from collections import defaultdict
  import re
  from nltk.corpus import stopwords
  from nltk.tokenize import word_tokenize
  from typing import Callable, Optional, Dict, List, Set
  from xai.data.constants import TermFrequencyType
  from xai.data.exceptions import InvalidTypeError, UndefinedRequiredParams
  from xai.data.explorer.abstract_analyzer import AbstractDataAnalyzer
  from xai.data.explorer.text.text_stats import TextStats
label_desc: Use image node_id 2 for calling the TextDataAnalyzer obj's underlying member method code with example usage: obj.feed(doc) without return types