Github user mengxr commented on a diff in the pull request: https://github.com/apache/spark/pull/2952#discussion_r19451869 --- Diff: docs/mllib-feature-extraction.md --- @@ -162,6 +162,28 @@ for((synonym, cosineSimilarity) <- synonyms) { } {% endhighlight %} </div> +<div data-lang="python"> +{% highlight python %} +# example uses text8 file from http://mattmahoney.net/dc/text8.zip +# the file was unziped and split into multiple lines using +# grep -o '[^ ]\+' text8 > text8_lines +# this was done so that the example can be run in local mode + +from pyspark import SparkContext +from pyspark.mllib.feature import Word2Vec + +sc = SparkContext(appName='Word2Vec') +inp = sc.textFile("text8_chunked").map(λ row: [row]) --- End diff -- `λ` -> `lambda` (do not use special chars) If we use sentences, this should be `row.split(' ')`.
--- 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