class_docstr: A component that locates and extract answers to a given query from Documents. It's used for performing extractive
  QA. The Reader assigns a score to every possible answer span independently of other answer spans.
  This fixes a common issue of other implementations which make comparisons across documents harder by normalizing
  each document's answers independently.
  
  Example usage:
  ```python
  p = Pipeline()
  p.add_component(instance=InMemoryBM25Retriever(document_store=InMemoryDocumentStore()), name="retriever")
  p.add_component(instance=ExtractiveReader(), name="reader")
  p.connect("retriever", "reader")
  question = "Who lives in Berlin?"
  p.run({"retriever": {"query": question}, "reader": {"query": question}})
  ```
docstr: Reconstructs the nested structure that existed before flattening. Also computes a no answer score.
  This score is different from most other implementations because it does not consider the no answer
  logit introduced with SQuAD 2. Instead, it just computes the probability that the answer does not exist
  in the top k or top p.
docstr_tok: ["Reconstructs","the","nested","structure","that","existed","before","flattening",".","Also","computes","a","no","answer","score",".","This","score","is","different","from","most","other","implementations","because","it","does","not","consider","the","no","answer","logit","introduced","with","SQuAD","2",".","Instead",",","it","just","computes","the","probability","that","the","answer","does","not","exist","in","the","top","k","or","top","p","."]
code: def _nest_answers(
      self,
      start: List[List[int]],
      end: List[List[int]],
      probabilities: "torch.Tensor",
      flattened_documents: List[Document],
      queries: List[str],
      answers_per_seq: int,
      top_k: Optional[int],
      score_threshold: Optional[float],
      query_ids: List[int],
      document_ids: List[int],
      no_answer: bool,
      overlap_threshold: Optional[float],
  ) -> List[List[ExtractedAnswer]]:
      """
      Reconstructs the nested structure that existed before flattening. Also computes a no answer score.
      This score is different from most other implementations because it does not consider the no answer
      logit introduced with SQuAD 2. Instead, it just computes the probability that the answer does not exist
      in the top k or top p.
      """
      answers_without_query = []
      for (
          document_id,
          start_candidates_,
          end_candidates_,
          probabilities_,
      ) in zip(document_ids, start, end, probabilities):
          for start_, end_, probability in zip(
              start_candidates_, end_candidates_, probabilities_
          ):
              doc = flattened_documents[document_id]
              answers_without_query.append(
                  ExtractedAnswer(
                      query="",  # Can't be None but we'll add it later
                      data=doc.content[start_:end_],  # type: ignore
                      document=doc,
                      score=probability.item(),
                      document_offset=ExtractedAnswer.Span(
                          start_, end_
                      ),
                      meta={},
                  )
              )
      i = 0
      nested_answers = []
      for query_id in range(query_ids[-1] + 1):
          current_answers = []
          while (
              i < len(answers_without_query)
              and query_ids[i // answers_per_seq] == query_id
          ):
              answer = answers_without_query[i]
              answer.query = queries[query_id]
              current_answers.append(answer)
              i += 1
          current_answers = sorted(
              current_answers, key=lambda ans: ans.score, reverse=True
          )
          current_answers = self.deduplicate_by_overlap(
              current_answers, overlap_threshold=overlap_threshold
          )
          current_answers = current_answers[:top_k]
          if no_answer:
              no_answer_score = math.prod(
                  1 - answer.score for answer in current_answers
              )
              answer_ = ExtractedAnswer(
                  data=None,
                  query=queries[query_id],
                  meta={},
                  document=None,
                  score=no_answer_score,
              )
              current_answers.append(answer_)
          current_answers = sorted(
              current_answers, key=lambda ans: ans.score, reverse=True
          )
          if score_threshold is not None:
              current_answers = [
                  answer
                  for answer in current_answers
                  if answer.score >= score_threshold
              ]
          nested_answers.append(current_answers)
  
      return nested_answers
  
imports: from pathlib import Path
  from typing import Any, Dict, List, Optional, Tuple, Union
  import math
  import warnings
  import logging
  from haystack import component, default_to_dict, default_from_dict, ComponentError, Document, ExtractedAnswer
  from haystack.lazy_imports import LazyImport
  from haystack.utils import get_device
label_desc: Use image node_id 9 for calling the ExtractiveReader obj's underlying member method code with example usage: obj._nest_answers(start, end, probabilities, flattened_documents, queries, answers_per_seq, top_k, score_threshold, query_ids, document_ids, no_answer, overlap_threshold) and returns: nested_answers