code: def get_metadata_offsets(self, doc):
      text = str(doc)
      offset_tokens = {}
      for (
          topic,
          start_index,
          end_index,
      ) in self.keyword_processor.extract_keywords(
          text, span_info=True
      ):
          token_stats = offset_tokens.setdefault(topic, [0, []])
          token_stats[0] += 1
          token_stats[1].append((start_index, end_index))
      return list(offset_tokens.items())
  
file_path: scattertext/scattertext/features/CognitiveDistortionsOffsetGetter.py
imports: from typing import Dict, List, Optional
  from scattertext.features.featoffsets.feat_and_offset_getter import FeatAndOffsetGetter
  import flashtext
label_desc: Use image node_id 3 for calling the LexiconFeatAndOffsetGetter obj's underlying member method code with example usage: obj.get_metadata_offsets(doc) and returns: list