novy slovnik substantiv
[krypto.git] / ocesavac.py
index e1d0f59..f762333 100644 (file)
@@ -1,7 +1,7 @@
 """Modul pro odstranovani diakritiky a zvlastnich znaku."""
-import unicodedata
 
-ABECEDA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+import unicodedata
+from spolecne import ABECEDA
 
 def deaccent(unistr):
     """Vrati text bez akcentu. Pochybna metoda pouzivajici unicodedata."""
@@ -28,3 +28,14 @@ def ocesat(text, mezery=True):
         return ''.join(pole)
     else: # bez mezer
         return ''.join([c for c in text if c in ABECEDA])
+
+def interactive():
+    import sys
+    import codecs
+    sys.stdin = codecs.getreader('utf-8')(sys.stdin)
+    sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
+    for line in sys.stdin.readlines():
+        print " ".join(deaccent(line).lower().split())
+
+if __name__ == '__main__':
+    interactive()