projekty
/
krypto.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6873dd4
)
drobnosti
author
Tomas Musil
<tomik.musil@gmail.com>
Sat, 24 Mar 2012 20:09:20 +0000
(21:09 +0100)
committer
Tomas Musil
<tomik.musil@gmail.com>
Sat, 24 Mar 2012 20:09:20 +0000
(21:09 +0100)
TODO
patch
|
blob
|
history
koincidence.py
patch
|
blob
|
history
diff --git
a/TODO
b/TODO
index
2cd1318
..
a0cf25f
100644
(file)
--- a/
TODO
+++ b/
TODO
@@
-1,4
+1,5
@@
==Nutno dodelat==
==Nutno dodelat==
+zbavit se mnohonasobneho ocesavani textu
efektivni jakobsen
roztridit a prehazet obsah jednotlivych souboru
v robot.py jenom handling mailu
efektivni jakobsen
roztridit a prehazet obsah jednotlivych souboru
v robot.py jenom handling mailu
diff --git
a/koincidence.py
b/koincidence.py
index
5a41dfa
..
efb903c
100644
(file)
--- a/
koincidence.py
+++ b/
koincidence.py
@@
-13,15
+13,15
@@
def index_koincidence(text, mezery=False):
return float(shod)/(len(t)*(len(t) - 1))
def index_koincidence2(text1, text2):
return float(shod)/(len(t)*(len(t) - 1))
def index_koincidence2(text1, text2):
- #predpokladam, ze v textech jsou jenom znaky se kterymi pocitam
+ """Pro dva texty vraci index koincidence. Texty nijak neupravuje,
+ ocekava ze se skladaji pouze ze znaku pracovni abecedy."""
shod = sum (x == y for x, y in zip(text1, text2))
return float(shod)/min(len(text1), len(text2))
def index_rozkladu(text, deleni):
if (deleni == 1):
return index_koincidence(text)
shod = sum (x == y for x, y in zip(text1, text2))
return float(shod)/min(len(text1), len(text2))
def index_rozkladu(text, deleni):
if (deleni == 1):
return index_koincidence(text)
- t = ocesat(text, False) #zatim bez mezer
- texty = rozklad(t, deleni)
+ texty = rozklad(ocesat(text, False), deleni)
return sum([index_koincidence(text) for text in texty])/len(texty)
def tabulka_indexu(text):
return sum([index_koincidence(text) for text in texty])/len(texty)
def tabulka_indexu(text):