code: def _multiprocess_batch_extract_n_grams(
      sentences: List[str],
      n: int = 4,
      n_workers: int = 1,
      verbose: bool = False,
  ) -> List[Dict[Tuple[str], int]]:
      if n_workers == 1:
          return _batch_extract_n_grams(sentences, n)
      else:
          batches = list(_batch(sentences, n_batches=n_workers))
          with ProcessPoolExecutor(max_workers=n_workers) as executor:
              futures = {
                  executor.submit(_batch_extract_n_grams, b, n): i
                  for i, b in enumerate(batches)
              }
              progress = as_completed(futures)
              if verbose:
                  progress = tqdm(progress)
              tmp = {
                  futures[future]: future.result()
                  for future in progress
              }
          result = []
          for k in sorted(tmp):
              result.extend(tmp[k])
          return result
  
file_path: vizseq/vizseq/scorers/_cider/__init__.py
imports: from typing import List, Dict, Tuple
  from collections import defaultdict
  import math
  from concurrent.futures import ProcessPoolExecutor, as_completed
  import numpy
  from tqdm import tqdm
label_desc: Use image node_id 4 for calling a global function with example usage: _multiprocess_batch_extract_n_grams(sentences, n, n_workers, verbose) and returns: _batch_extract_n_grams, result