projects
/
cipher-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Test for column transposition break now done
[cipher-tools.git]
/
segment.py
diff --git
a/segment.py
b/segment.py
index 27bf103c573f0d228a03741ef34dd360138ad072..712895b6b0d7f1563ee4149fe7d94445a3931233 100644
(file)
--- a/
segment.py
+++ b/
segment.py
@@
-3,18
+3,11
@@
import string
import collections
from math import log10
import itertools
import collections
from math import log10
import itertools
+import sys
+from functools import lru_cache
+sys.setrecursionlimit(1000000)
-def memo(f):
- "Memoize function f."
- table = {}
- def fmemo(*args):
- if args not in table:
- table[args] = f(*args)
- return table[args]
- fmemo.memo = table
- return fmemo
-
-@memo
+@lru_cache()
def segment(text):
"""Return a list of words that is the best segmentation of text.
"""
def segment(text):
"""Return a list of words that is the best segmentation of text.
"""