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: Check if this is the 'max context' doc span for the token.
  Because of the sliding window approach taken to scoring documents,
  a single token can appear in multiple documents.
  Example:
      Doc: the man went to the store and bought a gallon of milk
      Span A: the man went to the
      Span B: to the store and bought
      Span C: and bought a gallon of
      ...
  Now the word 'bought' will have two scores from spans B and C. We only
  want to consider the score with "maximum context", which we define as
  the *minimum* of its left and right context (the *sum* of left and
  right context will always be the same, of course).
  In the example the maximum context for 'bought' would be span C since
  it has 1 left context and 3 right context, while span B has 4 left context
  and 0 right context.
  Code adapted from the code by the Google AI and HuggingFace.
docstr_tok: ["Check","if","this","is","the","'max","context","'","doc","span","for","the","token",".","Because","of","the","sliding","window","approach","taken","to","scoring","documents",",","a","single","token","can","appear","in","multiple","documents",".","Example",":","Doc",":","the","man","went","to","the","store","and","bought","a","gallon","of","milk","Span","A",":","the","man","went","to","the","Span","B",":","to","the","store","and","bought","Span","C",":","and","bought","a","gallon","of","...","Now","the","word","'bought","'","will","have","two","scores","from","spans","B","and","C.","We","only","want","to","consider","the","score","with","``","maximum","context","''",",","which","we","define","as","the","*","minimum","*","of","its","left","and","right","context","(","the","*","sum","*","of","left","and","right","context","will","always","be","the","same",",","of","course",")",".","In","the","example","the","maximum","context","for","'bought","'","would","be","span","C","since","it","has","1","left","context","and","3","right","context",",","while","span","B","has","4","left","context","and","0","right","context",".","Code","adapted","from","the","code","by","the","Google","AI","and","HuggingFace","."]
code: def check_is_max_context(doc_spans, cur_span_index, position):
      """
      Check if this is the 'max context' doc span for the token.
      Because of the sliding window approach taken to scoring documents,
      a single token can appear in multiple documents.
      Example:
          Doc: the man went to the store and bought a gallon of milk
          Span A: the man went to the
          Span B: to the store and bought
          Span C: and bought a gallon of
          ...
      Now the word 'bought' will have two scores from spans B and C. We only
      want to consider the score with "maximum context", which we define as
      the *minimum* of its left and right context (the *sum* of left and
      right context will always be the same, of course).
      In the example the maximum context for 'bought' would be span C since
      it has 1 left context and 3 right context, while span B has 4 left context
      and 0 right context.
      Code adapted from the code by the Google AI and HuggingFace.
      """
  
      best_span_index = QADataset.get_best_span_index(
          doc_spans, position
      )
  
      return cur_span_index == best_span_index
  
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 8 for calling the QADataset obj's underlying member method code with example usage: obj.check_is_max_context(doc_spans, cur_span_index, position) and returns: unknown