class_docstr: Abstract base class for QA Datasets with common utility methods 
class_docstr_tok: ["Abstract","base","class","for","QA","Datasets","with","common","utility","methods"]
docstr: Get docspans which are sliding window spans from a document
  
  Args:
      all_doc_tokens: list of all tokens in document
      max_tokens_for_doc: maximum number of tokens in each doc span
      doc_stride: stride size which sliding window moves with
  
  Returns:
      doc_spans: all possible doc_spans from document
docstr_tok: ["Get","docspans","which","are","sliding","window","spans","from","a","document","Args",":","all_doc_tokens",":","list","of","all","tokens","in","document","max_tokens_for_doc",":","maximum","number","of","tokens","in","each","doc","span","doc_stride",":","stride","size","which","sliding","window","moves","with","Returns",":","doc_spans",":","all","possible","doc_spans","from","document"]
code: def get_docspans(all_doc_tokens, max_tokens_for_doc, doc_stride):
      """
      Get docspans which are sliding window spans from a document
  
      Args:
          all_doc_tokens: list of all tokens in document
          max_tokens_for_doc: maximum number of tokens in each doc span
          doc_stride: stride size which sliding window moves with
  
      Returns:
          doc_spans: all possible doc_spans from document
      """
  
      _DocSpan = collections.namedtuple("DocSpan", ["start", "length"])
      doc_spans = []
      start_offset = 0
      while start_offset < len(all_doc_tokens):
          length = len(all_doc_tokens) - start_offset
          if length > max_tokens_for_doc:
              length = max_tokens_for_doc
          doc_spans.append(_DocSpan(start=start_offset, length=length))
          if start_offset + length == len(all_doc_tokens):
              break
          start_offset += min(length, doc_stride)
  
      return doc_spans
  
imports: import collections
  import pickle
  from functools import lru_cache
  from typing import List
  import psutil
  import torch
  from nemo.collections.nlp.data.data_utils import is_whitespace
  from nemo.collections.nlp.data.question_answering.data_processor.qa_processing import EVALUATION_MODE, INFERENCE_MODE, TRAINING_MODE
  from nemo.core.classes import Dataset
  from nemo.utils import logging
label_desc: Use image node_id 9 for calling the QADataset obj's underlying member method code with example usage: obj.get_docspans(all_doc_tokens, max_tokens_for_doc, doc_stride) and returns: doc_spans