Commit b454d924 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[PHYLO] adding ids (Period/Level/Group).

parent 1aae8a6f
...@@ -43,8 +43,8 @@ data Phylo = Phylo { _phyloDuration :: (Start, End) ...@@ -43,8 +43,8 @@ data Phylo = Phylo { _phyloDuration :: (Start, End)
, _phyloPeriods :: [PhyloPeriod] , _phyloPeriods :: [PhyloPeriod]
} deriving (Generic) } deriving (Generic)
type Start = UTCTime type Start = UTCTime -- TODO: format EPOCH unix integer
type End = UTCTime type End = UTCTime -- TODO: format EPOCH unix integer
type Ngram = (NgramId, Text) type Ngram = (NgramId, Text)
type NgramId = Int type NgramId = Int
...@@ -52,24 +52,30 @@ type NgramId = Int ...@@ -52,24 +52,30 @@ type NgramId = Int
-- | PhyloStep : steps of phylomemy on temporal axis -- | PhyloStep : steps of phylomemy on temporal axis
-- Period: tuple (start date, end date) of the step of the phylomemy -- Period: tuple (start date, end date) of the step of the phylomemy
-- Levels: levels of granularity -- Levels: levels of granularity
data PhyloPeriod = PhyloPeriod { _phyloPeriodDuration :: (Start, End) data PhyloPeriod = PhyloPeriod { _phyloPeriodId :: PhyloPeriodId
, _phyloPeriodLevels :: [PhyloLevel] , _phyloPeriodLevels :: [PhyloLevel]
} deriving (Generic) } deriving (Generic)
type PhyloPeriodId = (Start, End)
-- | PhyloLevel : levels of phylomemy on level axis -- | PhyloLevel : levels of phylomemy on level axis
-- Levels description: -- Levels description:
-- Level -1: Ngram equals itself (by identity) == _phyloNgrams -- Level -1: Ngram equals itself (by identity) == _phyloNgrams
-- Level 0: Group of synonyms (by stems + by qualitative expert meaning) -- Level 0: Group of synonyms (by stems + by qualitative expert meaning)
-- Level 1: First level of clustering -- Level 1: First level of clustering
-- Level N: Nth level of clustering -- Level N: Nth level of clustering
type PhyloLevel = [PhyloGroup] data PhyloLevel = PhyloLevel { _phyloLevelId :: PhyloLevelId
, _phyloLevelGroups :: [PhyloGroup]
} deriving (Generic)
type PhyloLevelId = (PhyloPeriodId, Int)
-- | PhyloGroup : group of ngrams at each level and step -- | PhyloGroup : group of ngrams at each level and step
-- Label : maybe has a label as text -- Label : maybe has a label as text
-- Ngrams: set of terms that build the group -- Ngrams: set of terms that build the group
-- Period Parents|Childs: directed and weighted link to Parents|Childs (Temporal Period axis) -- Period Parents|Childs: directed and weighted link to Parents|Childs (Temporal Period axis)
-- Level Parents|Childs: directed and weighted link to Parents|Childs (Level Granularity axis) -- Level Parents|Childs: directed and weighted link to Parents|Childs (Level Granularity axis)
data PhyloGroup = PhyloGroup { _phyloGroupId :: GroupId data PhyloGroup = PhyloGroup { _phyloGroupId :: PhyloGroupId
, _phyloGroupLabel :: Maybe Text , _phyloGroupLabel :: Maybe Text
, _phyloGroupNgrams :: [NgramId] , _phyloGroupNgrams :: [NgramId]
...@@ -80,11 +86,12 @@ data PhyloGroup = PhyloGroup { _phyloGroupId :: GroupId ...@@ -80,11 +86,12 @@ data PhyloGroup = PhyloGroup { _phyloGroupId :: GroupId
, _phyloGroupLevelChilds :: [Edge] , _phyloGroupLevelChilds :: [Edge]
} deriving (Generic) } deriving (Generic)
type PhyloGroupId = (PhyloPeriodId, PhyloLevelId, Int)
type Edge = (PhyloGroupId, Weight) type Edge = (PhyloGroupId, Weight)
type Weight = Double type Weight = Double
type PhyloGroupId = Int
-- | JSON instances -- | JSON instances
$(deriveJSON (unPrefix "_phylo" ) ''Phylo ) $(deriveJSON (unPrefix "_phylo" ) ''Phylo )
$(deriveJSON (unPrefix "_phyloPeriod" ) ''PhyloPeriod ) $(deriveJSON (unPrefix "_phyloPeriod" ) ''PhyloPeriod )
$(deriveJSON (unPrefix "_phyloLevel" ) ''PhyloLevel )
$(deriveJSON (unPrefix "_phyloGroup" ) ''PhyloGroup ) $(deriveJSON (unPrefix "_phyloGroup" ) ''PhyloGroup )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment