Created
May 3, 2011 17:08
-
-
Save jsundram/953731 to your computer and use it in GitHub Desktop.
Convert a hadoop output file to a format suitable for use by Wordle.net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def to_wordle(s): | |
f = open(s) | |
g = open('wordle.txt', 'w') | |
for line in f: | |
token, count = line.strip().split('\t') | |
g.write('%s: %s\n' % (token, count)) | |
f.close() | |
g.close() | |
if __name__ == '__main__': | |
s = sys.argv[1] # e.g. /path/to/part-00000 | |
to_wordle(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment