Textonyms: Difference between revisions

Content added Content deleted
Line 928: Line 928:
codeGroups = groupBy (on (==) snd) . sortOn snd $ encodings
codeGroups = groupBy (on (==) snd) . sortOn snd $ encodings
textonyms = filter ((1 <) . length) codeGroups
textonyms = filter ((1 <) . length) codeGroups
mapM_
putStrLn
digitCount = length . snd . head
[ambiguous, longer] =
[take 5 . flip sortBy textonyms] <*>
(flip . comparing <$> [length, digitCount])
[wa, wl] = maximum . map digitCount <$> [ambiguous, longer]
mapM_ putStrLn $
[ "There are " ++
[ "There are " ++
show (length encodings) ++
show (length encodings) ++
Line 943: Line 938:
, show (length textonyms) ++ " digit combinations represent textonyms."
, show (length textonyms) ++ " digit combinations represent textonyms."
, ""
, ""
]
, "5 most ambiguous:"
] ++
let digitCount = length . snd . head
[ambiguous, longer] =
[take 5 . flip sortBy textonyms] <*>
(flip . comparing <$> [length, digitCount])
[wa, wl] = maximum . map digitCount <$> [ambiguous, longer]
mapM_ putStrLn $
"Five most ambiguous:" :
fmap (showTextonym wa) ambiguous ++
fmap (showTextonym wa) ambiguous ++
["", "5 longest:"] ++ fmap (showTextonym wl) longer
"" : "Five longest:" : fmap (showTextonym wl) longer


------------------------- DISPLAY --------------------------
------------------------- DISPLAY --------------------------