Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Christian Merten
haskell-gargantext
Commits
02da3a03
Commit
02da3a03
authored
Feb 15, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Notes MEETING] Phylomemy work with Quentin and David.
parent
d5b62df5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
13 deletions
+122
-13
Phylo.hs
src/Gargantext/Viz/Phylo.hs
+14
-13
Tools.hs
src/Gargantext/Viz/Phylo/Tools.hs
+108
-0
No files found.
src/Gargantext/Viz/Phylo.hs
View file @
02da3a03
...
...
@@ -7,7 +7,7 @@ Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
Specifications of Phylomemy format.
Specifications of Phylomemy
export
format.
Phylomemy can be described as a Temporal Graph with different scale of
granularity of group of ngrams (terms and multi-terms).
...
...
@@ -39,9 +39,9 @@ import Gargantext.Core.Utils.Prefix (unPrefix)
import
Gargantext.Prelude
------------------------------------------------------------------------
data
Phylo
Forma
t
=
Phylo
Format
{
_phyloForma
t_param
::
PhyloParam
,
_phylo
Forma
t_data
::
Phylo
data
Phylo
Expor
t
=
Phylo
Export
{
_phyloExpor
t_param
::
PhyloParam
,
_phylo
Expor
t_data
::
Phylo
}
deriving
(
Generic
)
-- | .phylo parameters
...
...
@@ -66,7 +66,7 @@ data Software =
-- Ngrams : list of all (possible) terms contained in the phylomemy (with their id)
-- Steps : list of all steps to build the phylomemy
data
Phylo
=
Phylo
{
_phylo_
p
uration
::
(
Start
,
End
)
Phylo
{
_phylo_
d
uration
::
(
Start
,
End
)
,
_phylo_ngrams
::
[
Ngram
]
,
_phylo_periods
::
[
PhyloPeriod
]
}
...
...
@@ -109,27 +109,28 @@ type PhyloLevelId = (PhyloPeriodId, Int)
-- Ngrams: set of terms that build the group
-- Period Parents|Childs: weighted link to Parents|Childs (Temporal Period axis)
-- Level Parents|Childs: weighted link to Parents|Childs (Level Granularity axis)
-- Pointers are directed link from Self to any PhyloGroup (/= Self ?)
data
PhyloGroup
=
PhyloGroup
{
_phylo_groupId
::
PhyloGroupId
,
_phylo_groupLabel
::
Maybe
Text
,
_phylo_groupNgrams
::
[
NgramsId
]
,
_phylo_groupPeriodParents
::
[
Edge
]
,
_phylo_groupPeriodChilds
::
[
Edge
]
,
_phylo_groupPeriodParents
::
[
Pointer
]
,
_phylo_groupPeriodChilds
::
[
Pointer
]
,
_phylo_groupLevelParents
::
[
Edge
]
,
_phylo_groupLevelChilds
::
[
Edge
]
,
_phylo_groupLevelParents
::
[
Pointer
]
,
_phylo_groupLevelChilds
::
[
Pointer
]
}
deriving
(
Generic
)
type
PhyloGroupId
=
(
PhyloLevelId
,
Int
)
type
Edge
=
(
PhyloGroupId
,
Weight
)
type
Pointer
=
(
PhyloGroupId
,
Weight
)
type
Weight
=
Double
-- | Lenses
makeLenses
''
P
hylo
makeLenses
''
P
hyloParam
makeLenses
''
P
hylo
Forma
t
makeLenses
''
P
hylo
Expor
t
makeLenses
''
S
oftware
-- | JSON instances
...
...
@@ -138,9 +139,9 @@ $(deriveJSON (unPrefix "_phylo_period" ) ''PhyloPeriod )
$
(
deriveJSON
(
unPrefix
"_phylo_level"
)
''
P
hyloLevel
)
$
(
deriveJSON
(
unPrefix
"_phylo_group"
)
''
P
hyloGroup
)
--
$
(
deriveJSON
(
unPrefix
"_software_"
)
''
S
oftware
)
$
(
deriveJSON
(
unPrefix
"_software_"
)
''
S
oftware
)
$
(
deriveJSON
(
unPrefix
"_phyloParam_"
)
''
P
hyloParam
)
$
(
deriveJSON
(
unPrefix
"_phylo
Format_"
)
''
P
hyloFormat
)
$
(
deriveJSON
(
unPrefix
"_phylo
Export_"
)
''
P
hyloExport
)
-- | TODO XML instances
src/Gargantext/Viz/Phylo/Tools.hs
0 → 100644
View file @
02da3a03
{-|
Module : Gargantext.Viz.Phylo.Tools
Description : Phylomemy tools
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
Phylo Toolbox:
- functions to build a Phylo
- functions to filter the cliques
- functions to manage a Phylo
Group Functions (TODO list)
- cohesion sur un groupe
- distance au dernier branchement
- âge du groupe
Futre Idea: temporal zoom on Phylo
phyloZoomOut :: (PeriodGrain, Phylo) -> [(PeriodGrain, Phylo)]
(from smallest granularity, it increases (zoom out) the periods of the Phylo)
Moral idea: viz from out to in
-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
module
Gargantext.Viz.Phylo.Tools
where
import
Data.Set
(
Set
)
import
Data.Map
(
Map
)
import
Data.Map
as
Map
hiding
(
Map
)
import
Gargantext.Prelude
import
Gargantext.Viz.Phylo
import
Gargantext.Viz.Phylo.Example
-- | Building a phylo
-- (Indicative and schematic function)
buildPhylo
::
Support
->
MinSize
->
Map
Clique
Support
->
Phylo
buildPhylo
s
m
mcs
=
level2Phylo
.
groups2level
.
clusters2group
.
map
clique2cluster
.
filterCliques
s
m
level2Phylo
::
PhyloLevel
->
Phylo
->
Phylo
level2Phylo
=
undefined
groups2level
::
[
PhyloGroup
]
->
PhyloLevel
groups2level
=
undefined
clusters2group
::
[
Cluster
Ngrams
]
->
PhyloGroup
clusters2group
=
undefined
clique2cluster
::
Clique
->
Cluster
Ngrams
clique2cluster
=
undefined
-- | Filtering the cliques before bulding the Phylo
-- (Support and MinSize as parameter of the finale function to build a phylo)
-- idea: log of Corpus size (of docs)
filterCliques
::
Support
->
MinSize
->
Map
Clique
Support
->
[
Clique
]
filterCliques
s
ms
=
maximalCliques
.
filterWithSizeSet
ms
.
Map
.
keys
.
filterWithSupport
s
type
Clique
=
Set
Ngrams
type
Support
=
Int
type
MinSize
=
Int
-- | Hapaxify / Threshold
-- hapax s = 1
-- ?
filterWithSupport
::
Support
->
Map
Clique
Support
->
Map
Clique
Support
filterWithSupport
s
=
Map
.
filter
(
>
s
)
filterWithSizeSet
::
MinSize
->
[
Clique
]
->
[
Clique
]
filterWithSizeSet
=
undefined
-- | filtre les cliques de ngrams compris dans une clique plus grande
-- /!\ optim inside
maximalCliques
::
[
Clique
]
->
[
Clique
]
maximalCliques
=
undefined
-- | Phylo management
-- | PhyloLevel Management
viewGroups
::
(
Start
,
End
)
->
PhyloLevel
->
Phylo
->
[
PhyloGroup
]
viewGroups
=
undefined
viewLevels
::
(
Start
,
End
)
->
Phylo
->
[
PhyloLevel
]
viewLevels
=
undefined
-- | tous les terme des champs, tous les parents et les enfants
setGroup
::
PhyloGroup
->
PhyloGroup
->
PhyloGroup
setGroup
=
undefined
--removeTerms :: recalculer les cliques pour ces termes
--addTerms
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment