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: This de-duplicates overlapping Extractive Answers from the same document based on how much the spans of the
  answers overlap.
  
  :param answers: List of answers to be deduplicated.
  :param overlap_threshold: If set this will remove duplicate answers if they have an overlap larger than the
      supplied threshold. For example, for the answers "in the river in Maine" and "the river" we would remove
      one of these answers since the second answer has a 100% (1.0) overlap with the first answer.
      However, for the answers "the river in" and "in Maine" there is only a max overlap percentage of 25% so
      both of these answers could be kept if this variable is set to 0.24 or lower.
      If None is provided then all answers are kept.
docstr_tok: ["This","de-duplicates","overlapping","Extractive","Answers","from","the","same","document","based","on","how","much","the","spans","of","the","answers","overlap",".",":","param","answers",":","List","of","answers","to","be","deduplicated",".",":","param","overlap_threshold",":","If","set","this","will","remove","duplicate","answers","if","they","have","an","overlap","larger","than","the","supplied","threshold",".","For","example",",","for","the","answers","``","in","the","river","in","Maine","''","and","``","the","river","''","we","would","remove","one","of","these","answers","since","the","second","answer","has","a","100","%","(","1.0",")","overlap","with","the","first","answer",".","However",",","for","the","answers","``","the","river","in","''","and","``","in","Maine","''","there","is","only","a","max","overlap","percentage","of","25","%","so","both","of","these","answers","could","be","kept","if","this","variable","is","set","to","0.24","or","lower",".","If","None","is","provided","then","all","answers","are","kept","."]
code: def deduplicate_by_overlap(
      self,
      answers: List[ExtractedAnswer],
      overlap_threshold: Optional[float],
  ) -> List[ExtractedAnswer]:
      """
      This de-duplicates overlapping Extractive Answers from the same document based on how much the spans of the
      answers overlap.
  
      :param answers: List of answers to be deduplicated.
      :param overlap_threshold: If set this will remove duplicate answers if they have an overlap larger than the
          supplied threshold. For example, for the answers "in the river in Maine" and "the river" we would remove
          one of these answers since the second answer has a 100% (1.0) overlap with the first answer.
          However, for the answers "the river in" and "in Maine" there is only a max overlap percentage of 25% so
          both of these answers could be kept if this variable is set to 0.24 or lower.
          If None is provided then all answers are kept.
      """
      if overlap_threshold is None:
          return answers
  
      # Initialize with the first answer and its offsets_in_document
      deduplicated_answers = [answers[0]]
  
      # Loop over remaining answers to check for overlaps
      for ans in answers[1:]:
          keep = self._should_keep(
              candidate_answer=ans,
              current_answers=deduplicated_answers,
              overlap_threshold=overlap_threshold,
          )
          if keep:
              deduplicated_answers.append(ans)
  
      return deduplicated_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 12 for calling the ExtractiveReader obj's underlying member method code with example usage: obj.deduplicate_by_overlap(answers, overlap_threshold) and returns: deduplicated_answers, answers