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: Split and tokenize Documents and preserve structures by returning mappings to query and Document IDs.
docstr_tok: ["Split","and","tokenize","Documents","and","preserve","structures","by","returning","mappings","to","query","and","Document","IDs","."]
code: def _preprocess(
      self,
      queries: List[str],
      documents: List[Document],
      max_seq_length: int,
      query_ids: List[int],
      stride: int,
  ) -> Tuple[
      "torch.Tensor",
      "torch.Tensor",
      "torch.Tensor",
      List["Encoding"],
      List[int],
      List[int],
  ]:
      """
      Split and tokenize Documents and preserve structures by returning mappings to query and Document IDs.
      """
      texts = []
      document_ids = []
      for i, doc in enumerate(documents):
          if doc.content is None:
              warnings.warn(
                  f"Document with id {doc.id} was passed to ExtractiveReader. The Document doesn't "
                  f"contain any text and it will be ignored."
              )
              continue
          texts.append(doc.content)
          document_ids.append(i)
      encodings_pt = self.tokenizer(
          queries,
          [document.content for document in documents],
          padding=True,
          truncation=True,
          max_length=max_seq_length,
          return_tensors="pt",
          return_overflowing_tokens=True,
          stride=stride,
      )
  
      input_ids = encodings_pt.input_ids.to(self.device)
      attention_mask = encodings_pt.attention_mask.to(self.device)
  
      query_ids = [
          query_ids[index]
          for index in encodings_pt.overflow_to_sample_mapping
      ]
      document_ids = [
          document_ids[sample_id]
          for sample_id in encodings_pt.overflow_to_sample_mapping
      ]
  
      encodings = encodings_pt.encodings
      sequence_ids = torch.tensor(
          [
              [
                  id_ if id_ is not None else -1
                  for id_ in encoding.sequence_ids
              ]
              for encoding in encodings
          ]
      ).to(self.device)
  
      return (
          input_ids,
          attention_mask,
          sequence_ids,
          encodings,
          query_ids,
          document_ids,
      )
  
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 7 for calling the ExtractiveReader obj's underlying member method code with example usage: obj._preprocess(queries, documents, max_seq_length, query_ids, stride) and returns: input_ids,  attention_mask,  sequence_ids,  encodings,  query_ids,  document_ids