News for hackers. Stuff that matters.
Re:Haskell version of Norvig's spelling corrector by bazzargh on Friday December 19, 2014 @01:43PM (#8773719)
all that, plus, re the question at the end of the article about chooseBest:

    chooseBest ch ws = maximumBy (compare `on` (\w -> M.findWithDefault 0 w ws))
       (S.toList ch)
this is closer to what's in Norvig's article - a single pass over the elements of 'ch', taking the one whose entry in the 'ws' set has the highest count - treating words not in the set as having a count of 0. No sort required. (maximumBy is from Data.List, on is from Data.Function)

There are no comments on this comment yet.