diff python/lolspeak.py @ 0:f3ab51c79813

adding configuration from https://svn.openplans.org/svn/config_jhammel/
author k0s <k0scist@gmail.com>
date Thu, 15 Oct 2009 11:41:26 -0400
parents
children 89121bfe12ff
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/lolspeak.py	Thu Oct 15 11:41:26 2009 -0400
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+
+loldict = { 'am': 'is',
+            'and': 'n',
+            'are': 'r',
+            'ate': 'eated',
+            'back': 'bak',
+            'business': 'bizness',
+            'bye': 'bai',
+            'cat': 'kitteh',
+            'cheeseburger': 'cheezburger',
+            'cute': 'kyooot',
+            'food': 'foodz',
+            'fucking': 'fuxing',
+            'have': 'has',
+            'help': 'halp',
+            'hi': 'hai',
+            'is': 'iz',
+            'kitty': 'kitteh',
+            'later': 'l8r',
+            'making': 'makin',
+            'means': 'meens',
+            'more': 'moar',
+            'news': 'newz',
+            'please': 'plz',
+            'power': 'powr',
+            'saturday': 'caturday',
+            'says': 'sez',
+            'takes': 'takez',
+            'thanks': 'kthx',
+            'time': 'tiem',
+            'the': 'teh',
+            'there': 'thar',
+            'this': 'dis',
+            'towel': 'towul',
+            'uses': 'uzes',
+            'young': 'yung',
+            'your': 'ur'
+            }
+
+def translate(string):
+    retval = []
+    for word in string.split():
+        retval.append(loldict.get(word.lower(), word))
+    return ' '.join(retval)
+
+if __name__ == '__main__':
+    import sys
+    if sys.argv[1:]:
+        print translate(' '.join(sys.argv[1:]))
+    else:
+        print translate(sys.stdin.read())
+