code: def cosine_similarity(vec1, vec2):
      """
      calculate cosine similarity between 2 vecs
  
      Args:
          vec1(numpy.array): input vec 1
          vec2(numpy.array): input vec 2
  
      Returns:
          float: cosine_sim, cosine similarity between 2 vecs
  
  
      """
  
      cosine_sim = 0
      try:
          norm_vec1 = norm(vec1)
          norm_vec2 = norm(vec2)
          den = norm_vec1 * norm_vec2
          if den != 0:
              cosine_sim = dot(vec1, vec2) / den
      except (
          ValueError
      ):  # if target word is not in embedding dictionary
          cosine_sim = 0
  
      return cosine_sim
  
file_path: nlp-architect/examples/most_common_word_sense/feature_extraction.py
imports: import re
  import nltk
  import numpy
  from numpy import dot
  from numpy.linalg import norm
  from nlp_architect.utils.generic import license_prompt
label_desc: Use image node_id 5 for calling a global function with example usage: cosine_similarity(vec1, vec2) and returns: cosine_sim