class_docstr: Text span index class.
  Holds TF and DF values per span. Text spans are normalized and similar
  spans are mapped to the same TF DF values.
class_docstr_tok: ["Text","span","index","class",".","Holds","TF","and","DF","values","per","span",".","Text","spans","are","normalized","and","similar","spans","are","mapped","to","the","same","TF","DF","values","."]
code: def __init__(self, documents: list, spans: list):
      self.df_index = {}  # span to DF
      self.tf_index = {}  # span, doc to TF
      self.pid_to_spans = {}  # id to spans (normalized types)
      self.word_to_phrase_index = {}
      self.documents = set()
      for d, phrases in zip(documents, spans):
          doc_id = CorpusIndex.get_docid(d)
          self.documents.add(doc_id)
          for phrase in phrases:
              pid = CorpusIndex.get_pid(phrase)
              # add to norm phrases dict
              if pid not in self.pid_to_spans:
                  self.pid_to_spans[pid] = set()
              self.pid_to_spans[pid].add(phrase)
  
              # add to df index
              if self.df_index.get(pid, None) is None:
                  self.df_index[pid] = {doc_id}
              else:
                  self.df_index[pid].add(doc_id)
  
              # add to tf index
              if self.tf_index.get(pid, None) is None:
                  self.tf_index[pid] = 1
              else:
                  self.tf_index[pid] += 1
  
              for word in phrase:
                  wid = self.get_wid(word)
                  if wid not in self.word_to_phrase_index:
                      self.word_to_phrase_index[wid] = set()
                  self.word_to_phrase_index[wid].add(pid)
  
imports: import itertools
  import math
  import numpy
  import logging
  from spacy.tokens.doc import Doc
  from spacy.tokens.span import Span
  from spacy.tokens.token import Token
label_desc: Use image node_id 1 to create a new CorpusIndex object  with example: obj = CorpusIndex(documents, spans)