Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15105#discussion_r79139615
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/feature/Word2Vec.scala ---
    @@ -518,25 +518,42 @@ class Word2VecModel private[spark] (
       }
     
       /**
    -   * Find synonyms of a word
    +   * Find synonyms of a word; do not include the word itself in results.
        * @param word a word
        * @param num number of synonyms to find
        * @return array of (word, cosineSimilarity)
        */
       @Since("1.1.0")
       def findSynonyms(word: String, num: Int): Array[(String, Double)] = {
         val vector = transform(word)
    -    findSynonyms(vector, num)
    +    findSynonyms(vector, num, Some(word))
       }
     
       /**
    -   * Find synonyms of the vector representation of a word
    +   * Find synonyms of the vector representation of a word, possibly
    +   * including any words in the model vocabulary whose vector 
respresentation
    +   * is the supplied vector.
        * @param vector vector representation of a word
        * @param num number of synonyms to find
        * @return array of (word, cosineSimilarity)
        */
       @Since("1.1.0")
       def findSynonyms(vector: Vector, num: Int): Array[(String, Double)] = {
    +    findSynonyms(vector, num, None)
    +  }
    +
    +  /**
    +   * Find synonyms of the vector representation of a word, rejecting
    +   * words identical to the value of wordOpt, if one is supplied.
    +   * @param vector vector representation of a word
    +   * @param num number of synonyms to find
    +   * @param wordOpt optionally, a word to reject from the results list
    +   * @return array of (word, cosineSimilarity)
    +   */
    +  private[spark] def findSynonyms(
    --- End diff --
    
    This can be private then, I think.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to