docstr: Test relative_cosine_similarity returns expected results with an input of a word pair and topn
docstr_tok: ["Test","relative_cosine_similarity","returns","expected","results","with","an","input","of","a","word","pair","and","topn"]
code: def test_relative_cosine_similarity(self):
      """Test relative_cosine_similarity returns expected results with an input of a word pair and topn"""
      wordnet_syn = [
          "good",
          "goodness",
          "commodity",
          "trade_good",
          "full",
          "estimable",
          "honorable",
          "respectable",
          "beneficial",
          "just",
          "upright",
          "adept",
          "expert",
          "practiced",
          "proficient",
          "skillful",
          "skilful",
          "dear",
          "near",
          "dependable",
          "safe",
          "secure",
          "right",
          "ripe",
          "well",
          "effective",
          "in_effect",
          "in_force",
          "serious",
          "sound",
          "salutary",
          "honest",
          "undecomposed",
          "unspoiled",
          "unspoilt",
          "thoroughly",
          "soundly",
      ]  # synonyms for "good" as per wordnet
      cos_sim = [
          self.vectors.similarity("good", syn)
          for syn in wordnet_syn
          if syn in self.vectors
      ]
      cos_sim = sorted(
          cos_sim, reverse=True
      )  # cosine_similarity of "good" with wordnet_syn in decreasing order
      # computing relative_cosine_similarity of two similar words
      rcs_wordnet = self.vectors.similarity("good", "nice") / sum(
          cos_sim[i] for i in range(10)
      )
      rcs = self.vectors.relative_cosine_similarity("good", "nice", 10)
      self.assertTrue(rcs_wordnet >= rcs)
      self.assertTrue(np.allclose(rcs_wordnet, rcs, 0, 0.125))
      # computing relative_cosine_similarity for two non-similar words
      rcs = self.vectors.relative_cosine_similarity("good", "worst", 10)
      self.assertTrue(rcs < 0.10)
  
imports: import functools
  import logging
  import unittest
  import numpy
  from gensim.models.keyedvectors import KeyedVectors, REAL, pseudorandom_weak_vector
  from gensim.test.utils import datapath
  import gensim.models.keyedvectors
label_desc: Use image node_id 10 for calling the TestKeyedVectors obj's underlying member method code with example usage: obj.test_relative_cosine_similarity() without return types