drobne upravy v indexu koincidence
authorTomas Musil <tomik.musil@gmail.com>
Fri, 30 Mar 2012 09:23:44 +0000 (11:23 +0200)
committerTomas Musil <tomik.musil@gmail.com>
Fri, 30 Mar 2012 09:23:44 +0000 (11:23 +0200)
koincidence.py
robot.py

index b471a20..fd6277a 100644 (file)
@@ -38,8 +38,4 @@ def tabulka_indexu(text):
 def rozklad(text, deleni):
     """Vrati pole retezcu, v kazdem jsou znaky z puvodniho textu jejichz pozice
     ma stejny zbytek po deleni cislem 'deleni'."""
-    texty = []
-    for i in range(deleni):
-        texty.append(''.join(
-            [text[j] for j in range(len(text)) if j % deleni == i]))
-    return texty
+    return [text[i::deleni] for i in range(deleni)]
index 7f651e1..96f5a5b 100755 (executable)
--- a/robot.py
+++ b/robot.py
@@ -142,7 +142,8 @@ if mod_m:
     analyza.append("\nIndex koincidence (s mezerami):")
     analyza.append('{0:.2%}'.format(
                    koincidence.index_koincidence(zprava, True)))
-if mod_x:
+if mod_x and len(zprava) >= 10:
+    #TODO tady by se spravne mela porovnavat delka ocesane zpravy
     analyza.append("\nIndexy koincidence (bez mezer):")
     analyza.append(koincidence.tabulka_indexu(zprava))