bugfix
[krypto.git] / koincidence.py
index 24c250c..5a41dfa 100644 (file)
@@ -1,8 +1,10 @@
 from ocesavac import ocesat
 from collections import deque
 
-def index_koincidence(text):
-    t = ocesat(text, False) #zatim bez mezer
+def index_koincidence(text, mezery=False):
+    t = ocesat(text, mezery)
+    if mezery:
+        t = t[1:-1]
     deq = deque(t)
     shod = 0
     for i in range(1, len(t)):
@@ -10,7 +12,7 @@ def index_koincidence(text):
         shod += sum (x == y for x, y in zip(deq, t))
     return float(shod)/(len(t)*(len(t) - 1))
 
-def index_koincidence(text1, text2):
+def index_koincidence2(text1, text2):
     #predpokladam, ze v textech jsou jenom znaky se kterymi pocitam
     shod = sum (x == y for x, y in zip(text1, text2))
     return float(shod)/min(len(text1), len(text2))