Skip to content

Instantly share code, notes, and snippets.

@jsundram
Created May 3, 2011 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsundram/953731 to your computer and use it in GitHub Desktop.
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
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