Portability : POSIX
-}
-{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
+
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE Arrows #-}
module Gargantext.Database.Action.Metrics.Lists
where
-import Gargantext.API.Ngrams (TabType(..))
+import Gargantext.API.Ngrams.Types (TabType(..))
+import Gargantext.Core.Text.Metrics (Scored(..))
import Gargantext.Core.Types -- (NodePoly(..), NodeCorpus, ListId)
-import Gargantext.Database.Action.Flow (FlowCmdM)
+import Gargantext.Database.Action.Flow.Types (FlowCmdM)
import Gargantext.Prelude hiding (sum, head)
-import Gargantext.Core.Text.Metrics (Scored(..))
import Prelude hiding (null, id, map, sum)
+import qualified Data.HashMap.Strict as HashMap
import qualified Data.Map as Map
import qualified Data.Vector as Vec
import qualified Gargantext.Database.Action.Metrics as Metrics
-
{-
trainModel :: FlowCmdM env ServantErr m
=> Username -> m Score
let
metrics = map (\(Scored t s1 s2) -> (listType t ngs', [Vec.fromList [s1,s2]])) scores
- listType t m = maybe (panic errorMsg) fst $ Map.lookup t m
+ listType t m = maybe (panic errorMsg) fst $ HashMap.lookup t m
errorMsg = "API.Node.metrics: key absent"
{-
_ <- Learn.grid 100 110 metrics' metrics'
--}
- pure $ Map.fromListWith (<>) metrics
+ pure $ Map.fromListWith (<>) $ Vec.toList metrics