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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
26cec98c
Commit
26cec98c
authored
Mar 29, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PHYLO] first draft for types.
parent
60b07ef4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
0 deletions
+88
-0
Phylo.hs
src/Gargantext/Types/Phylo.hs
+88
-0
No files found.
src/Gargantext/Types/Phylo.hs
0 → 100644
View file @
26cec98c
{-|
Module : Gargantext.Types.Nodes
Description : Main Types of Nodes
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
Specifications of Phylomemy format.
Phylomemy can be described as a Temporal Graph with different scale of
granularity of group of terms.
The main type is Phylo which is synonym of Phylomemy (only difference is
the number of chars).
Phylomemy was first described in [REF].
-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleInstances #-}
module
Gargantext.Types.Phylo
where
import
Data.Aeson
(
ToJSON
,
FromJSON
)
import
Data.Maybe
(
Maybe
)
import
Data.Text
(
Text
)
import
Data.Time
(
UTCTime
)
import
GHC.Generics
(
Generic
)
import
Gargantext.Prelude
------------------------------------------------------------------------
-- | Phylo datatype descriptors:
-- Period: time Segment of the whole phylomemy in UTCTime format (start,end)
-- Terms : list of all (possible) terms contained in the phylomemy (with their id)
-- Steps : list of all steps to build the phylomemy
data
Phylo
=
Phylo
{
_phyloPeriod
::
(
Start
,
End
)
,
_phyloNgrams
::
[
Ngram
]
,
_phyloSteps
::
[
PhyloStep
]
}
deriving
(
Generic
)
type
Ngram
=
(
NgramId
,
Text
)
type
NgramId
=
Int
type
Start
=
UTCTime
type
End
=
UTCTime
-- | PhyloStep data type descriptor
-- Period: tuple (start date, end date) of the step of the phylomemy
-- Levels: levels of granularity
data
PhyloStep
=
PhyloStep
{
_phyloStepPeriod
::
(
Start
,
End
)
,
_phyloStepLevels
::
[
Level
]
}
deriving
(
Generic
)
-- | Level of a step of a Phylomemy
-- Label: maybe has a label as text
-- Terms: 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
,
_levelTerms
::
[
NgramId
]
,
_levelTemporalParents
::
[
NgramId
]
,
_levelTemporalChilds
::
[
NgramId
]
,
_levelGranularityParents
::
[
NgramId
]
,
_levelGranularityChilds
::
[
NgramId
]
}
deriving
(
Generic
)
-- | JSON instances
instance
FromJSON
Phylo
instance
ToJSON
Phylo
instance
FromJSON
PhyloStep
instance
ToJSON
PhyloStep
instance
FromJSON
Level
instance
ToJSON
Level
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