docstr: Compute the cosine similarity of two vectors.
  :param vec_h: array of dictionary for vector corresponding to hypothesis
  :param vec_r: array of dictionary for vector corresponding to reference
  :param norm_h: array of float for vector corresponding to hypothesis
  :param norm_r: array of float for vector corresponding to reference
  :param len_h: int containing length of hypothesis
  :param len_r: int containing length of reference
  :param sigma: float
  :return: array of score for each n-grams cosine similarity
docstr_tok: ["Compute","the","cosine","similarity","of","two","vectors",".",":","param","vec_h",":","array","of","dictionary","for","vector","corresponding","to","hypothesis",":","param","vec_r",":","array","of","dictionary","for","vector","corresponding","to","reference",":","param","norm_h",":","array","of","float","for","vector","corresponding","to","hypothesis",":","param","norm_r",":","array","of","float","for","vector","corresponding","to","reference",":","param","len_h",":","int","containing","length","of","hypothesis",":","param","len_r",":","int","containing","length","of","reference",":","param","sigma",":","float",":","return",":","array","of","score","for","each","n-grams","cosine","similarity"]
code: def _get_sim(
      self,
      vec_h: List[Dict[Tuple[str], float]],
      vec_r: List[Dict[Tuple[str], float]],
      norm_h: List[float],
      norm_r: List[float],
      len_h: int,
      len_r: int,
      sigma: float,
  ) -> np.ndarray:
      """
      Compute the cosine similarity of two vectors.
      :param vec_h: array of dictionary for vector corresponding to hypothesis
      :param vec_r: array of dictionary for vector corresponding to reference
      :param norm_h: array of float for vector corresponding to hypothesis
      :param norm_r: array of float for vector corresponding to reference
      :param len_h: int containing length of hypothesis
      :param len_r: int containing length of reference
      :param sigma: float
      :return: array of score for each n-grams cosine similarity
      """
      delta = float(len_h - len_r)
      # measure cosine similarity
      val = np.array([0.0 for _ in range(self.n)])
      for n in range(self.n):
          for ngram, count in vec_h[n].items():
              val[n] += (
                  min(vec_h[n][ngram], vec_r[n][ngram])
                  * vec_r[n][ngram]
              )
          if norm_h[n] != 0 and norm_r[n] != 0:
              val[n] /= norm_h[n] * norm_r[n]
          assert not math.isnan(val[n])
          val[n] *= np.e ** (-(delta**2) / (2 * sigma**2))
      return val
  
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 3 for calling the _CIDErScorer obj's underlying member method code with example usage: obj._get_sim(vec_h, vec_r, norm_h, norm_r, len_h, len_r, sigma) and returns: val