-- | Build a dictionary from a list of words.
fromWords :: [Text.Text] -> Dictionary
fromWords ws = Dictionary $ foldr insertWord mempty ws
  where insertWord w m = case fingerprint w of
                          Nothing -> m
                          Just f  -> Map.insertWith mappend f (return w) m

-- | Pull out all the words in a @Dictionary@.
fromWords :: [Text.Text] -> Dictionary
fromWords ws = Dictionary $ foldr insertWord mempty ws
  where insertWord w m = case fingerprint w of
                          Nothing -> m
                          Just f  -> Map.insertWith mappend f (return w) m

-- | Pull out all the words in a @Dictionary@.
fromWords ws = Dictionary $ foldr insertWord mempty ws
  where insertWord w m = case fingerprint w of
                          Nothing -> m
                          Just f  -> Map.insertWith mappend f (return w) m

-- | Pull out all the words in a @Dictionary@.