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
147
Issues
147
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
gargantext
haskell-gargantext
Commits
04232270
Commit
04232270
authored
Mar 30, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PHYLO] adding groups.
parent
463f55dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
29 deletions
+33
-29
Phylo.hs
src/Gargantext/Types/Phylo.hs
+33
-29
No files found.
src/Gargantext/Types/Phylo.hs
View file @
04232270
...
...
@@ -19,10 +19,11 @@ Phylomemy was first described in [REF].
-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
module
Gargantext.Types.Phylo
where
import
Data.Aeson
(
ToJSON
,
From
JSON
)
import
Data.Aeson
.TH
(
derive
JSON
)
import
Data.Maybe
(
Maybe
)
import
Data.Text
(
Text
)
import
Data.Time
(
UTCTime
)
...
...
@@ -30,12 +31,13 @@ import Data.Time (UTCTime)
import
GHC.Generics
(
Generic
)
import
Gargantext.Prelude
import
Gargantext.Utils.Prefix
(
unPrefix
)
------------------------------------------------------------------------
-- | Phylo datatype descriptor
-- Period: time Segment of the whole phylomemy in UTCTime format (start,end)
-- | Phylo datatype descriptor
of a phylomemy
-- Period
: time Segment of the whole phylomemy in UTCTime format (start,end)
-- Ngrams : list of all (possible) terms contained in the phylomemy (with their id)
-- Steps : list of all steps to build the phylomemy
-- Steps
: list of all steps to build the phylomemy
data
Phylo
=
Phylo
{
_phyloPeriod
::
(
Start
,
End
)
,
_phyloNgrams
::
[
Ngram
]
,
_phyloSteps
::
[
PhyloStep
]
...
...
@@ -47,39 +49,41 @@ type End = UTCTime
type
Ngram
=
(
NgramId
,
Text
)
type
NgramId
=
Int
-- | PhyloStep
datatype descriptor
-- | PhyloStep
: steps of phylomemy on temporal axis
-- Period: tuple (start date, end date) of the step of the phylomemy
-- Levels: levels of granularity
data
PhyloStep
=
PhyloStep
{
_phyloStepPeriod
::
(
Start
,
End
)
,
_phyloStepLevels
::
[
Level
]
,
_phyloStepLevels
::
[
Phylo
Level
]
}
deriving
(
Generic
)
-- | Level of a step of a Phylomemy descriptor
-- | PhyloLevel : levels of phylomemy on level axis
-- Levels description:
-- Level 0: Ngram equals itself (by identity) == _phyloNgrams
-- Level 1: Group gathers synonyms (by stems + by qualitative expert meaning)
-- Level 2: Group is Frequent Item Set (by statistics)
-- Level 3: Group is a cluster or community (by statistics)
type
PhyloLevel
=
[
PhyloGroup
]
-- | PhyloGroup : group of ngrams at each level and step
-- Label: maybe has a label as text
-- Ngrams: set of terms that build the group
-- Temporal Parents: directed and weighted link to Parents
-- Levels description:
-- Level 0: Ngram equals itself (by identity) == _phyloNgrams
-- Level 1: Semantic grouping (by stems + by qualitative expert meaning)
-- Level 2: Frequent Item Set groups (by statistics)
-- Level 3: Clustering (by statistics)
data
Level
=
Level
{
_levelLabel
::
Maybe
Text
,
_levelNgrams
::
[
NgramId
]
-- Temporal Parents|Childs: directed and weighted link to Parents|Childs (Temporal axis)
-- Granularity Parents|Childs: directed and weighted link to Parents|Childs (Granularity axis)
data
PhyloGroup
=
PhyloGroup
{
_phyloGroupLabel
::
Maybe
Text
,
_phyloGroupNgrams
::
[
NgramId
]
,
_levelTemporalParents
::
[
NgramId
]
,
_levelTemporalChilds
::
[
NgramId
]
,
_phyloGroupTemporalParents
::
[
Edge
]
,
_phyloGroupTemporalChilds
::
[
Edge
]
,
_levelGranularityParents
::
[
NgramId
]
,
_levelGranularityChilds
::
[
NgramId
]
}
deriving
(
Generic
)
,
_phyloGroupGranularityParents
::
[
Edge
]
,
_phyloGroupGranularityChilds
::
[
Edge
]
}
deriving
(
Generic
)
-- | JSON instances
instance
FromJSON
Phylo
instance
ToJSON
Phylo
instance
FromJSON
PhyloStep
instance
ToJSON
PhyloStep
instance
FromJSON
Level
instance
ToJSON
Level
type
Edge
=
(
NgramId
,
Weight
)
type
Weight
=
Double
-- | JSON instances
$
(
deriveJSON
(
unPrefix
"_phylo"
)
''
P
hylo
)
$
(
deriveJSON
(
unPrefix
"_phyloStep"
)
''
P
hyloStep
)
$
(
deriveJSON
(
unPrefix
"_phyloGroup"
)
''
P
hyloGroup
)
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