Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import sys
- import string
- def read_input(file):
- printable = set(string.printable)
- for line in file:
- line = filter(lambda x: x in printable, line)
- line = line.strip()
- yield line.lower().split()
- def main(separator='\t'):
- ascii_letters = set(string.ascii_letters)
- data = read_input(sys.stdin)
- for words in data:
- for word in words:
- word = filter(lambda x: x in ascii_letters, word)
- word = str.strip(word)
- if len(word) == 1:
- continue
- print '%s\t%s' % (word, 1)
- if __name__ == "__main__":
- main()
Add Comment
Please, Sign In to add comment