class_docstr: Base class for QA
class_docstr_tok: ["Base","class","for","QA"]
docstr: ```
  This method maps token indexes to actual word in the initial context.
  
  Args:
      text (str): The actual context to extract the answer from.
      start (int): The answer starting token index.
      end (int): The answer end token index.
  
  Returns:
      dct:  `{'answer': str, 'start': int, 'end': int}`
  ```
docstr_tok: ["``","`","This","method","maps","token","indexes","to","actual","word","in","the","initial","context",".","Args",":","text","(","str",")",":","The","actual","context","to","extract","the","answer","from",".","start","(","int",")",":","The","answer","starting","token","index",".","end","(","int",")",":","The","answer","end","token","index",".","Returns",":","dct",":","`","{","'answer","'",":","str",",","'start","'",":","int",",","'end","'",":","int","}","`","``","`"]
code: def _span_to_answer(self, question, text, start, end):
      """
      ```
      This method maps token indexes to actual word in the initial context.
  
      Args:
          text (str): The actual context to extract the answer from.
          start (int): The answer starting token index.
          end (int): The answer end token index.
  
      Returns:
          dct:  `{'answer': str, 'start': int, 'end': int}`
      ```
      """
      all_tokens = self.tokenizer.tokenize(
          text=question, pair=text, add_special_tokens=True
      )
      sep_idxs = [i for i, x in enumerate(all_tokens) if x == "[SEP]"]
      start = start - sep_idxs[0]
      end = end - sep_idxs[0]
  
      words = []
      token_idx = char_start_idx = char_end_idx = chars_idx = 0
      for i, word in enumerate(text.split(" ")):
          token = self.tokenizer.tokenize(word)
  
          # Append words if they are in the span
          if start <= token_idx <= end:
              if token_idx == start:
                  char_start_idx = chars_idx
  
              if token_idx == end:
                  char_end_idx = chars_idx + len(word)
  
              words += [word]
  
          # Stop if we went over the end of the answer
          if token_idx > end:
              break
  
          # Append the subtokenization length to the running index
          token_idx += len(token)
          chars_idx += len(word) + 1
  
      # Join text with spaces
      return {
          "answer": " ".join(words),
          "start": max(0, char_start_idx),
          "end": min(len(text), char_end_idx),
      }
  
imports: from transformers import AutoModelForQuestionAnswering, AutoTokenizer, TFAutoModelForQuestionAnswering
  from whoosh import index, qparser
  from whoosh.fields import *
  from whoosh.qparser import QueryParser
  from ...None import utils
  from ...imports import *
  from ...torch_base import TorchBase
  from ..None import preprocessor
  from ..None import textutils
  from itertools import chain, zip_longest
label_desc: Use image node_id 7 for calling the ExtractiveQABase obj's underlying member method code with example usage: obj._span_to_answer(question, text, start, end) and returns: dict