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: Calculates the amount of overlap (in number of characters) between two answer offsets.
  
  Stack overflow post explaining how to calculate overlap between two ranges:
      https://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap/325964#325964
docstr_tok: ["Calculates","the","amount","of","overlap","(","in","number","of","characters",")","between","two","answer","offsets",".","Stack","overflow","post","explaining","how","to","calculate","overlap","between","two","ranges",":","https",":","\/\/stackoverflow.com\/questions\/325933\/determine-whether-two-date-ranges-overlap\/325964","#","325964"]
code: def _calculate_overlap(
      self,
      answer1_start: int,
      answer1_end: int,
      answer2_start: int,
      answer2_end: int,
  ) -> int:
      """
      Calculates the amount of overlap (in number of characters) between two answer offsets.
  
      Stack overflow post explaining how to calculate overlap between two ranges:
          https://stackoverflow.com/questions/325933/determine-whether-two-date-ranges-overlap/325964#325964
      """
      # Check for overlap: (StartA <= EndB) and (StartB <= EndA)
      if answer1_start <= answer2_end and answer2_start <= answer1_end:
          return min(
              answer1_end - answer1_start,
              answer1_end - answer2_start,
              answer2_end - answer1_start,
              answer2_end - answer2_start,
          )
      return 0
  
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 10 for calling the ExtractiveReader obj's underlying member method code with example usage: obj._calculate_overlap(answer1_start, answer1_end, answer2_start, answer2_end) and returns: int, min