class_docstr: Question-Answering-based Information Extraction
class_docstr_tok: ["Question-Answering-based","Information","Extraction"]
docstr: ```
  Extracts answers
  ```
docstr_tok: ["``","`","Extracts","answers","``","`"]
code: def _extract(
      self,
      questions,
      contexts,
      min_conf=DEFAULT_MIN_CONF,
      return_conf=False,
      batch_size=8,
  ):
      """
      ```
      Extracts answers
      ```
      """
      num_rows = len(contexts)
      doc_results = [
          {"rawtext": rawtext, "reference": row}
          for row, rawtext in enumerate(contexts)
      ]
      cols = []
      for q in questions:
          result_dict = {}
          conf_dict = {}
          answers = self.qa.ask(
              q, doc_results=doc_results, batch_size=batch_size
          )
          for a in answers:
              answer = (
                  a["answer"] if a["confidence"] > min_conf else None
              )
              lst = result_dict.get(a["reference"], [])
              lst.append(answer)
              result_dict[a["reference"]] = lst
              lst = conf_dict.get(a["reference"], [])
              lst.append(a["confidence"])
              conf_dict[a["reference"]] = lst
  
          results = []
          for i in range(num_rows):
              ans = [a for a in result_dict[i] if a is not None]
              results.append(None if not ans else " | ".join(ans))
          cols.append(results)
          if return_conf:
              confs = []
              for i in range(num_rows):
                  conf = [
                      str(round(c, 2))
                      for c in conf_dict[i]
                      if c is not None
                  ]
                  confs.append(None if not conf else " | ".join(conf))
              cols.append(confs)
      return cols
  
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 3 for calling the AnswerExtractor obj's underlying member method code with example usage: obj._extract(questions, contexts, min_conf, return_conf, batch_size) and returns: cols