diff options
Diffstat (limited to 'app/ProbabilityMap.hs')
-rw-r--r-- | app/ProbabilityMap.hs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/app/ProbabilityMap.hs b/app/ProbabilityMap.hs index 9a700d7..dc7067d 100644 --- a/app/ProbabilityMap.hs +++ b/app/ProbabilityMap.hs @@ -25,7 +25,7 @@ import Control.Applicative (liftA2) import Control.Arrow ((***)) import Control.DeepSeq (NFData (..)) import Control.Exception (SomeException, try) -import Control.Parallel.Strategies +import Control.Parallel.Strategies (parList, rdeepseq, withStrategy) import Data.Binary qualified as B import Data.List (foldl') import Data.Map qualified as M @@ -37,6 +37,7 @@ import Data.Vector.Binary () import Document qualified as D import GHC.Conc (numCapabilities) import GHC.Generics (Generic) +import Parallel (streamsOf) import Tag qualified as G data ProbabilityCache = ProbabilityCache @@ -178,14 +179,6 @@ probabilityMap (ProbabilityCache' {..}) = allTags = M.keys docsPerTag fi = fromIntegral @Int @Double -streamsOf :: Int -> [a] -> [[a]] -streamsOf 1 xs = [xs] -streamsOf n xs - | n > 0 = [everyN k xs | k <- [0 .. n - 1]] - | otherwise = [] - where - everyN k xs = map snd $ filter ((== k) . (`mod` n) . fst) $ zip [0 ..] xs - addDocument :: D.Document -> ProbabilityCache -> ProbabilityCache addDocument doc probabilityCache = fromProbabilityCache' $ addDocument' doc (toProbabilityCache' probabilityCache) |