Github user holdenk commented on a diff in the pull request: https://github.com/apache/spark/pull/17451#discussion_r137368179 --- Diff: mllib/src/main/scala/org/apache/spark/ml/feature/Word2Vec.scala --- @@ -274,6 +274,29 @@ class Word2VecModel private[ml] ( wordVectors.findSynonyms(word, num) } + /** --- End diff -- So instead of using _call_java you can use `self._java_obj.findSynonymsArray` and then call `list()` on the result. which will give you something like `[JavaObject id=o86, JavaObject id=o87]`. So you can do something like `map(lambda st: (st._1(), st._2()), list(tuples))` which gives you `[(u'b', 0.25053444504737854), (u'c', -0.6980510950088501)]`
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org