Github user yanboliang commented on a diff in the pull request: https://github.com/apache/spark/pull/17451#discussion_r123925233 --- Diff: python/pyspark/ml/feature.py --- @@ -2869,6 +2869,18 @@ def findSynonyms(self, word, num): word = _convert_to_vector(word) return self._call_java("findSynonyms", word, num) + @since("2.2.0") + def findSynonymsTuple(self, word, num): + """ + Find "num" number of words closest in similarity to "word". + word can be a string or vector representation. + Returns an array with two fields word and similarity (which + gives the cosine similarity). + """ + if not isinstance(word, basestring): + word = _convert_to_vector(word) + return self._call_java("findSynonymsTuple", word, num) + --- End diff -- We need to convert result back to array of tuple, which would be consistent with Scala output.
--- 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