]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Viz/Phylo/PhyloMaker.hs
add Wos parser
[gargantext.git] / src / Gargantext / Viz / Phylo / PhyloMaker.hs
1 {-|
2 Module : Gargantext.Viz.Phylo.PhyloMaker
3 Description : Maker engine for rebuilding a Phylo
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
8 Portability : POSIX
9 -}
10
11 {-# LANGUAGE NoImplicitPrelude #-}
12 {-# LANGUAGE FlexibleContexts #-}
13 {-# LANGUAGE OverloadedStrings #-}
14 {-# LANGUAGE MultiParamTypeClasses #-}
15
16 module Gargantext.Viz.Phylo.PhyloMaker where
17
18
19 import Data.Map (Map, fromListWith, keys, unionWith, fromList)
20
21 import Gargantext.Prelude
22 import Gargantext.Viz.AdaptativePhylo
23 import Gargantext.Viz.Phylo.PhyloTools
24
25
26 --------------------
27 -- | to Phylo 0 | --
28 --------------------
29
30 nbDocsByTime :: [Document] -> Int -> Map Date Double
31 nbDocsByTime docs step =
32 let docs' = fromListWith (+) $ map (\d -> (date d,1)) docs
33 time = fromList $ map (\t -> (t,0)) $ toTimeScale (keys docs') step
34 in unionWith (+) time docs'
35
36