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)):
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))