Updated notebooks for new library organisation
[cipher-tools.git] / support / text_prettify.py
index 60963f8ce712a6940ecf53d0314c620d04cd7a6c..751df38aeb661bd9aab907219a1545d53936e676 100644 (file)
@@ -1,6 +1,12 @@
 import string
 from support.segment import segment
-from support.utilities import cat, sanitise
+from support.utilities import cat, lcat, sanitise
+
+
+def prettify(text, width=100):
+    """Segment a text into words, then pack into lines, and combine the lines
+    into a single string for printing."""
+    return lcat(tpack(segment(text), width=width))
 
 
 def tpack(text, width=100):