code: def _extract_sentence_n_grams(
      s: str, n: int = 4
  ) -> Dict[Tuple[str], int]:
      """
      :param s: str : sentence to be converted into n-grams
      :param n: int : number of n-grams for which representation is calculated
      :return: term frequency vector for n-grams
      """
      words = s.split()
      counts = defaultdict(int)
      for k in range(1, n + 1):
          for i in range(len(words) - k + 1):
              ngram = tuple(words[i : i + k])
              counts[ngram] += 1
      return counts
  
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 2 for calling a global function with example usage: _extract_sentence_n_grams(s, n) and returns: counts