Filter confusables to some limits
authorunc0rr
Sun, 26 Jan 2014 00:09:50 +0400
changeset 10075 dbaf90a0fbe0
parent 10074 66cab76eb56f
child 10076 b235e520ea21
Filter confusables to some limits
tools/confuse.hs
--- a/tools/confuse.hs	Sun Jan 26 00:08:49 2014 +0400
+++ b/tools/confuse.hs	Sun Jan 26 00:09:50 2014 +0400
@@ -34,4 +34,8 @@
 
 main = do
     ll <- liftM (filter (isHexDigit . head) . filter (not . null) . lines) $ readFile "confusables.txt"
-    B.writeFile "rules.txt" . B.intercalate "\n" . map convRules . Map.toList . Map.fromList . filter (\(_, b) -> length b < 6). map toPair $ ll
+    B.writeFile "rules.txt" . B.intercalate "\n" . map convRules . Map.toList . Map.fromList . filter notTooLong . filter fits16bit . map toPair $ ll
+    where
+        notTooLong = (>) 6 . length . snd
+        fits16bit (a, b) = let f = (>) 5 . B.length in all f $ a:b
+