loadWds :: FilePath -> IO (Int, Index)
loadWds p =
    runResourceT $ CB.sourceFile
        ("/home/danl/p/l/melang/lang/de/base/" ++ p ++ "-wds.txt")
        $$ CB.lines
        =$ CC.foldl loadFold (0, BST.empty)
  where
    loadFold (!size, !index) !line =
        seq size2 $ seq index2
        (size2, index2)
      where
        (wd:countStr:_) = BSC.split '\t' line
        Just (count, _) = BSC.readInt countStr
        size2 = size + count
        wd2 = DTE.encodeUtf8 . DT.toLower $ DTE.decodeUtf8 wd
        index2 = seq wd2 $ BSTC.insertWith (+) wd2 count index
loadWds :: FilePath -> IO (Int, Index)
loadWds p =
    runResourceT $ CB.sourceFile
        ("/home/danl/p/l/melang/lang/de/base/" ++ p ++ "-wds.txt")
        $$ CB.lines
        =$ CC.foldl loadFold (0, BST.empty)
  where
    loadFold (!size, !index) !line =
        seq size2 $ seq index2
        (size2, index2)
      where
        (wd:countStr:_) = BSC.split '\t' line
        Just (count, _) = BSC.readInt countStr
        size2 = size + count
        wd2 = DTE.encodeUtf8 . DT.toLower $ DTE.decodeUtf8 wd
        index2 = seq wd2 $ BSTC.insertWith (+) wd2 count index
loadWds p =
    runResourceT $ CB.sourceFile
        ("/home/danl/p/l/melang/lang/de/base/" ++ p ++ "-wds.txt")
        $$ CB.lines
        =$ CC.foldl loadFold (0, BST.empty)
  where
    loadFold (!size, !index) !line =
        seq size2 $ seq index2
        (size2, index2)
      where
        (wd:countStr:_) = BSC.split '\t' line
        Just (count, _) = BSC.readInt countStr
        size2 = size + count
        wd2 = DTE.encodeUtf8 . DT.toLower $ DTE.decodeUtf8 wd
        index2 = seq wd2 $ BSTC.insertWith (+) wd2 count index