<s> from pyspark import SparkConf , SparkContext <EOL> import sys <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> if len ( sys . argv ) != <NUM_LIT:3> : <EOL> print "<STR_LIT>" <EOL> sys . exit ( - <NUM_LIT:1> ) <EOL> input = sys . argv [ <NUM_LIT:1> ] <EOL> output = sys . argv [ <NUM_LIT:2> ] <EOL> conf = SparkConf ( ) . setMaster ( "<STR_LIT>" ) . setAppName ( "<STR_LIT>" ) <EOL> sc = SparkContext ( conf = conf ) <EOL> sotu = sc . textFile ( input ) <EOL> counts = sotu . flatMap ( lambda line : line . split ( "<STR_LIT:U+0020>" ) ) . map ( lambda word : ( word , <NUM_LIT:1> ) ) . reduceByKey ( lambda a , b : a + b ) <EOL> counts . coalesce ( <NUM_LIT:1> ) . saveAsTextFile ( output ) <EOL> sc . stop ( ) <EOL> print "<STR_LIT>" </s>
