code: def lss_terms(
      embeddings,
      terms,
      pos_seed_words=None,
      neg_seed_words=None,
      seed_words=None,
      seed_values=None,
  ):
      neg_seed_words = [] if neg_seed_words is None else neg_seed_words
      pos_seed_words = [] if pos_seed_words is None else pos_seed_words
      seed_words = [] if seed_words is None else seed_words
      seed_values = [] if seed_values is None else seed_values
      for word, value in zip(
          (pos_seed_words + neg_seed_words),
          [1] * len(pos_seed_words) + [-1] * len(neg_seed_words),
      ):
          seed_words.append(word)
          seed_values.append(value)
  
      assert seed_values
      assert embeddings.shape[0] == len(terms)
      assert len(seed_words) == len(seed_values)
      missing_words = []
      for word in seed_words:
          if word not in terms:
              missing_words.append(word)
      if missing_words:
          raise Exception(
              f"No embedding(s) exists for {','.join(missing_words)}."
          )
  
      term2i = {term: i for i, term in enumerate(terms)}
      seed_mat = embeddings[[term2i[term] for term in seed_words], :]
  
      seed_norm = np.matrix(np.linalg.norm(seed_mat, axis=1))
      term_norm = np.matrix(np.linalg.norm(embeddings, axis=1))
  
      cosine_mat = (
          (seed_mat * embeddings.T).T / seed_norm
      ) / term_norm.T
  
      return pd.Series(
          (cosine_mat * np.matrix(seed_values).T).A1, index=terms
      )
  
imports: import logging
  import numpy
  import pandas
label_desc: Use image node_id 2 for calling a global function with example usage: lss_terms(embeddings, terms, pos_seed_words, neg_seed_words, seed_words, seed_values) and returns: pd