Deleted unnecessary files
[cipher-training.git] / segment.py
diff --git a/segment.py b/segment.py
deleted file mode 100644 (file)
index a64ea5d..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-"""Segment a collection of letters into words"""
-
-import language_models
-import sys
-from functools import lru_cache
-sys.setrecursionlimit(1000000)
-
-@lru_cache()
-def segment(text):
-    """Return a list of words that is the best segmentation of text.
-    """
-    if not text: return []
-    candidates = ([first]+segment(rest) for first, rest in splits(text))
-    return max(candidates, key=language_models.Pwords)
-
-@lru_cache()
-def segment_wrong(text):
-    """Return a list of words that is the best segmentation of text.
-    """
-    if not text: return []
-    candidates = ([first]+segment(rest) for first, rest in splits(text))
-    return max(candidates, key=language_models.Pwords_wrong)
-
-
-def splits(text, L=20):
-    """Return a list of all possible (first, rest) pairs, len(first)<=L.
-    """
-    return [(text[:i+1], text[i+1:])
-            for i in range(min(len(text), L))]
-