code: def _test_n_grams_based(
      self,
      scorer_type: Type[VizSeqScorer],
      min_speedup_ratio: float,
      ref_score: Optional[VizSeqScore] = None,
  ):
      # sentence-level score
      (
          score_sp,
          score_mp,
          time_sp,
          time_mp,
      ) = self._get_single_multi_proc_output_and_time(
          scorer_type, corpus_level=False, sent_level=True
      )
      self._verify_speed(
          time_sp, time_mp, min_speedup_ratio=min_speedup_ratio
      )
      self._verify_score(score_sp.sent_scores, score_mp.sent_scores)
      if ref_score is not None and ref_score.sent_scores is not None:
          self._verify_score(
              score_sp.sent_scores, ref_score.sent_scores
          )
  
      # corpus-level score
      (
          score_sp,
          score_mp,
          time_sp,
          time_mp,
      ) = self._get_single_multi_proc_output_and_time(
          scorer_type, corpus_level=True, sent_level=False
      )
      self._verify_speed(
          time_sp, time_mp, min_speedup_ratio=min_speedup_ratio
      )
      self._verify_score(score_sp.corpus_score, score_mp.corpus_score)
      if ref_score is not None and ref_score.corpus_score is not None:
          self._verify_score(
              score_sp.corpus_score, ref_score.corpus_score
          )
  
file_path: vizseq/tests/scorers/__init__.py
imports: import unittest
  import time
  import os
  from typing import Union, List, Optional, Type, Dict
  from vizseq.scorers import VizSeqScorer, VizSeqScore
label_desc: Use image node_id 5 for calling the VizSeqScorerTestCase obj's underlying member method code with example usage: obj._test_n_grams_based(scorer_type, min_speedup_ratio, ref_score) without return types