-}
-
{-# LANGUAGE OverloadedLists #-} -- allows to write Map and HashMap as lists
{-# LANGUAGE TypeOperators #-}
pure $ trace "[G.V.G.API] Graph exists, recomputing" graph'''
--- TODO use Database Monad only here ?
---computeGraph :: HasNodeError err
--- => CorpusId
--- -> Distance
--- -> NgramsType
--- -> NodeListStory
--- -> Cmd err Graph
computeGraph :: FlowCmdM env err m
=> CorpusId
-> Distance
$ mapTermListRoot [lId] nt repo
myCooc <- HashMap.filter (>1) -- Removing the hapax (ngrams with 1 cooc)
- <$> getCoocByNgrams (if d == Conditional then Diagonal True else Diagonal False)
+ -- <$> HashMap.filterWithKey (\(x,y) _ -> x /= y)
+ -- <$> getCoocByNgrams (if d == Conditional then Diagonal True else Diagonal False)
+ <$> getCoocByNgrams (Diagonal True)
<$> groupNodesByNgrams ngs
<$> getNodesByNgramsOnlyUser cId (lIds <> [lId]) nt (HashMap.keys ngs)
listNgrams <- getListNgrams [lId] nt
+ -- graph <- liftBase $ cooc2graphWith Bac d 0 myCooc
graph <- liftBase $ cooc2graphWith Spinglass d 0 myCooc
-- saveAsFileDebug "debug/graph" graph
+
pure $ mergeGraphNgrams graph (Just listNgrams)
}
-- (map (\n -> LegendField n "#FFFFFF" (pack $ show n)) [1..10])
-
------------------------------------------------------------
type GraphAsyncAPI = Summary "Recompute graph"
:> "recompute"
HyperdataGraphAPI { _hyperdataAPIGraph = graph } <- getGraph uId nId
pure $ addHeader "attachment; filename=graph.gexf" graph
-
-
-
-
-