[ Skip to the content ]

Institute of Formal and Applied Linguistics Wiki


[ Back to the navigation ]

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
spark:using-python [2022/12/14 13:00]
straka [Usage Examples]
spark:using-python [2022/12/14 13:00]
straka [Usage Examples]
Line 59: Line 59:
    .flatMap(lambda line: line.split())    .flatMap(lambda line: line.split())
    .map(lambda token: (token, 1))    .map(lambda token: (token, 1))
-   .reduceByKey(lambda x,y: x + y)+   .reduceByKey(lambda x, y: x + y)
    .sortBy(lambda word_count: word_count[1], ascending=False)    .sortBy(lambda word_count: word_count[1], ascending=False)
    .saveAsTextFile(output))    .saveAsTextFile(output))

[ Back to the navigation ] [ Back to the content ]