docstr: calculate cosine similarity scores between 2 terms
  
  Args:
      word_1 (str): 1st input word
      word_2 (str): 2nd input word
      embedding_dict (dict): embedding dictionary
  
  Returns:
      vectors_sim_dict[key] (float): similarity scores between the 2 input words
code: def calc_cosine_similarity(self, word_1, word_2, embedding_dict):
      """
      calculate cosine similarity scores between 2 terms
  
      Args:
          word_1 (str): 1st input word
          word_2 (str): 2nd input word
          embedding_dict (dict): embedding dictionary
  
      Returns:
          vectors_sim_dict[key] (float): similarity scores between the 2 input words
  
      """
      key = str(sorted([word_1, word_2]))
  
      if not self.vector_cache or key not in self.vectors_sim_dict:
          vector_1 = embedding_dict.get(word_1)
          vector_2 = embedding_dict.get(word_2)
  
          # check if both words have vectors
          if (
              np.count_nonzero(vector_1) > 0
              and np.count_nonzero(vector_2) > 0
          ):
              sim_score = cosine(vector_1, vector_2)
          else:
              sim_score = None
          self.vectors_sim_dict[key] = sim_score
  
      return self.vectors_sim_dict[key]
  
imports: import csv
  import pickle
  import numpy
  import tensorflow
  from os import PathLike
  from pathlib import Path
  from nlp_architect.models.absa.utils import _read_generic_lex_for_similarity
  from nlp_architect.models.absa import TRAIN_OUT, TRAIN_LEXICONS, GENERIC_OP_LEX, LEXICONS_OUT
  from scipy.spatial.distance import cosine
  from sklearn.model_selection import StratifiedKFold
  from tensorflow.keras.layers import Dense, Dropout
  from tensorflow.keras.models import Sequential, load_model
  from nlp_architect.utils.embedding import load_word_embeddings
label_desc: Use image node_id 2 for calling the RerankTerms obj's underlying member method code with example usage: obj.calc_cosine_similarity(word_1, word_2, embedding_dict) and returns: self