2 Module : Gargantext.Viz.Phylo.Tools
3 Description : Phylomemy tools
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
11 - functions to build a Phylo
12 - functions to filter the cliques
13 - functions to manage a Phylo
15 Group Functions (TODO list)
16 - cohesion sur un groupe
17 - distance au dernier branchement
20 Futre Idea: temporal zoom on Phylo
21 phyloZoomOut :: (PeriodGrain, Phylo) -> [(PeriodGrain, Phylo)]
22 (from smallest granularity, it increases (zoom out) the periods of the Phylo)
23 Moral idea: viz from out to in
27 {-# LANGUAGE NoImplicitPrelude #-}
28 {-# LANGUAGE FlexibleContexts #-}
29 {-# LANGUAGE OverloadedStrings #-}
31 module Gargantext.Viz.Phylo.Tools where
35 import Data.Map as Map hiding (Map)
36 import Gargantext.Prelude
37 import Gargantext.Viz.Phylo
38 import Gargantext.Viz.Phylo.Example
40 -- | Some types to help reading
41 type Clique = Set Ngrams
46 -- (Indicative and schematic function)
47 buildPhylo :: Support -> MinSize
48 -> Map Clique Support -> Phylo
49 buildPhylo s m mcs = level2Phylo
55 level2Phylo :: PhyloLevel -> Phylo -> Phylo
56 level2Phylo = undefined
58 groups2level :: [PhyloGroup] -> PhyloLevel
59 groups2level = undefined
61 clusters2group :: [Cluster Ngrams] -> PhyloGroup
62 clusters2group = undefined
64 clique2cluster :: Clique -> Cluster Ngrams
65 clique2cluster = undefined
67 -- | Filtering the cliques before bulding the Phylo
68 -- (Support and MinSize as parameter of the finale function to build a phylo)
69 -- idea: log of Corpus size (of docs)
70 filterCliques :: Support -> MinSize
71 -> Map Clique Support -> [Clique]
72 filterCliques s ms = maximalCliques
73 . filterWithSizeSet ms
77 -- | Hapaxify / Threshold
80 filterWithSupport :: Support -> Map Clique Support -> Map Clique Support
81 filterWithSupport s = Map.filter (>s)
83 filterWithSizeSet :: MinSize -> [Clique] -> [Clique]
84 filterWithSizeSet = undefined
86 -- | filtre les cliques de ngrams compris dans une clique plus grande
88 maximalCliques :: [Clique] -> [Clique]
89 maximalCliques = undefined
96 -- | PhyloLevel Management
97 viewGroups :: (Start,End) -> PhyloLevel -> Phylo -> [PhyloGroup]
98 viewGroups = undefined
100 viewLevels :: (Start,End) -> Phylo -> [PhyloLevel]
101 viewLevels = undefined
103 -- | tous les terme des champs, tous les parents et les enfants
104 setGroup :: PhyloGroup -> PhyloGroup -> PhyloGroup
106 --removeTerms :: recalculer les cliques pour ces termes