]> Git — Sourcephile - gargantext.git/blob - src/Gargantext/Viz/Phylo/Tools.hs
Try to build links from -1 to 0
[gargantext.git] / src / Gargantext / Viz / Phylo / Tools.hs
1 {-|
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
8 Portability : POSIX
9
10 Phylo Toolbox:
11 - functions to build a Phylo
12 - functions to filter the cliques
13 - functions to manage a Phylo
14
15 Group Functions (TODO list)
16 - cohesion sur un groupe
17 - distance au dernier branchement
18 - âge du groupe
19
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
24
25 -}
26
27 {-# LANGUAGE NoImplicitPrelude #-}
28 {-# LANGUAGE FlexibleContexts #-}
29 {-# LANGUAGE OverloadedStrings #-}
30
31 module Gargantext.Viz.Phylo.Tools where
32
33 import Data.Set (Set)
34 import Data.Map (Map)
35 import qualified Data.Map as Map
36 import Gargantext.Prelude
37 import Gargantext.Viz.Phylo
38 import Gargantext.Viz.Phylo.Example
39
40 type MinSize = Int
41
42 -- | Building a phylo
43 -- (Indicative and schematic function)
44 -- buildPhylo :: Support -> MinSize
45 -- -> Map Clique Support -> Phylo
46 -- buildPhylo s m mcs = level2Phylo
47 -- . groups2level
48 -- . clusters2group
49 -- . Map.map clique2cluster
50 -- . filterCliques s m
51
52 level2Phylo :: PhyloLevel -> Phylo -> Phylo
53 level2Phylo = undefined
54
55 groups2level :: [PhyloGroup] -> PhyloLevel
56 groups2level = undefined
57
58 -- clusters2group :: [Cluster Ngrams] -> PhyloGroup
59 -- clusters2group = undefined
60
61 -- clique2cluster :: Clique -> Cluster Ngrams
62 -- clique2cluster = undefined
63
64 -- | Filtering the cliques before bulding the Phylo
65 -- (Support and MinSize as parameter of the finale function to build a phylo)
66 -- idea: log of Corpus size (of docs)
67 filterCliques :: Support -> MinSize
68 -> Map Clique Support -> [Clique]
69 filterCliques s ms = maximalCliques
70 . filterWithSizeSet ms
71 . Map.keys
72 . filterWithSupport s
73
74 -- | Hapaxify / Threshold
75 -- hapax s = 1
76 -- ?
77 filterWithSupport :: Support -> Map Clique Support -> Map Clique Support
78 filterWithSupport s = Map.filter (>s)
79
80 filterWithSizeSet :: MinSize -> [Clique] -> [Clique]
81 filterWithSizeSet = undefined
82
83 -- | filtre les cliques de ngrams compris dans une clique plus grande
84 -- /!\ optim inside
85 maximalCliques :: [Clique] -> [Clique]
86 maximalCliques = undefined
87
88
89 -- | Phylo management
90
91 -- | PhyloLevel Management
92 viewGroups :: (Start,End) -> PhyloLevel -> Phylo -> [PhyloGroup]
93 viewGroups = undefined
94
95 viewLevels :: (Start,End) -> Phylo -> [PhyloLevel]
96 viewLevels = undefined
97
98 -- | tous les terme des champs, tous les parents et les enfants
99 setGroup :: PhyloGroup -> PhyloGroup -> PhyloGroup
100 setGroup = undefined
101 --removeTerms :: recalculer les cliques pour ces termes
102 --addTerms
103