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
9
Merge Requests
9
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
7d6fcbbc
Commit
7d6fcbbc
authored
Feb 15, 2019
by
Quentin Lobbé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
harmonized functions and types
parent
7da5cfa2
Pipeline
#196
failed with stage
Changes
3
Pipelines
1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
70 deletions
+115
-70
Phylo.hs
src/Gargantext/Viz/Phylo.hs
+29
-9
Example.hs
src/Gargantext/Viz/Phylo/Example.hs
+74
-46
Tools.hs
src/Gargantext/Viz/Phylo/Tools.hs
+12
-15
No files found.
src/Gargantext/Viz/Phylo.hs
View file @
7d6fcbbc
...
...
@@ -32,6 +32,9 @@ import Control.Lens (makeLenses)
import
Data.Aeson.TH
(
deriveJSON
)
import
Data.Maybe
(
Maybe
)
import
Data.Text
(
Text
)
import
Data.Set
(
Set
)
import
Data.Map
(
Map
)
import
Data.Vector
(
Vector
)
import
Data.Time.Clock.POSIX
(
POSIXTime
)
import
GHC.Generics
(
Generic
)
import
Gargantext.Database.Schema.Ngrams
(
NgramsId
)
...
...
@@ -67,17 +70,17 @@ data Software =
-- Steps : list of all steps to build the phylomemy
data
Phylo
=
Phylo
{
_phylo_duration
::
(
Start
,
End
)
,
_phylo_ngrams
::
[
Ngram
]
,
_phylo_ngrams
::
PhyloNgrams
,
_phylo_periods
::
[
PhyloPeriod
]
}
deriving
(
Generic
)
deriving
(
Generic
,
Show
)
-- | UTCTime in seconds since UNIX epoch
type
Start
=
POSIXTime
type
End
=
POSIXTime
-- type Start = POSIXTime
-- type End = POSIXTime
type
Start
=
Int
type
End
=
Int
-- | Indexed Ngram
type
Ngram
=
(
NgramsId
,
Text
)
-- | PhyloStep : steps of phylomemy on temporal axis
-- Period: tuple (start date, end date) of the step of the phylomemy
...
...
@@ -86,7 +89,7 @@ data PhyloPeriod =
PhyloPeriod
{
_phylo_periodId
::
PhyloPeriodId
,
_phylo_periodLevels
::
[
PhyloLevel
]
}
deriving
(
Generic
)
deriving
(
Generic
,
Show
)
type
PhyloPeriodId
=
(
Start
,
End
)
...
...
@@ -100,7 +103,7 @@ data PhyloLevel =
PhyloLevel
{
_phylo_levelId
::
PhyloLevelId
,
_phylo_levelGroups
::
[
PhyloGroup
]
}
deriving
(
Generic
)
deriving
(
Generic
,
Show
)
type
PhyloLevelId
=
(
PhyloPeriodId
,
Int
)
...
...
@@ -121,18 +124,35 @@ data PhyloGroup =
,
_phylo_groupLevelParents
::
[
Pointer
]
,
_phylo_groupLevelChilds
::
[
Pointer
]
}
deriving
(
Generic
)
deriving
(
Generic
,
Show
)
type
PhyloGroupId
=
(
PhyloLevelId
,
Int
)
type
Pointer
=
(
PhyloGroupId
,
Weight
)
type
Weight
=
Double
-- | Ngrams : a contiguous sequence of n terms
type
Ngrams
=
Text
-- | PhyloNgrams : Vector of all the Ngrams (PhyloGroup of level -1) used within a Phylo
type
PhyloNgrams
=
Vector
Ngrams
-- | Clique : Set of ngrams cooccurring in the same Document
type
Clique
=
Set
Ngrams
-- | Support : Number of Documents where a Clique occurs
type
Support
=
Int
-- | Fis : Frequent Items Set (ie: the association between a Clique and a Support)
type
Fis
=
Map
Clique
Support
-- | Lenses
makeLenses
''
P
hylo
makeLenses
''
P
hyloParam
makeLenses
''
P
hyloExport
makeLenses
''
S
oftware
-- | JSON instances
$
(
deriveJSON
(
unPrefix
"_phylo_"
)
''
P
hylo
)
$
(
deriveJSON
(
unPrefix
"_phylo_period"
)
''
P
hyloPeriod
)
...
...
src/Gargantext/Viz/Phylo/Example.hs
View file @
7d6fcbbc
This diff is collapsed.
Click to expand it.
src/Gargantext/Viz/Phylo/Tools.hs
View file @
7d6fcbbc
...
...
@@ -32,25 +32,22 @@ module Gargantext.Viz.Phylo.Tools where
import
Data.Set
(
Set
)
import
Data.Map
(
Map
)
import
Data.Map
as
Map
hiding
(
Map
)
import
qualified
Data.Map
as
Map
import
Gargantext.Prelude
import
Gargantext.Viz.Phylo
import
Gargantext.Viz.Phylo.Example
-- | Some types to help reading
type
Clique
=
Set
Ngrams
type
Support
=
Int
type
MinSize
=
Int
-- | 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
--
buildPhylo :: Support -> MinSize
--
-> Map Clique Support -> Phylo
--
buildPhylo s m mcs = level2Phylo
--
. groups2level
--
. clusters2group
-- . Map.
map clique2cluster
--
. filterCliques s m
level2Phylo
::
PhyloLevel
->
Phylo
->
Phylo
level2Phylo
=
undefined
...
...
@@ -58,11 +55,11 @@ level2Phylo = undefined
groups2level
::
[
PhyloGroup
]
->
PhyloLevel
groups2level
=
undefined
clusters2group
::
[
Cluster
Ngrams
]
->
PhyloGroup
clusters2group
=
undefined
--
clusters2group :: [Cluster Ngrams] -> PhyloGroup
--
clusters2group = undefined
clique2cluster
::
Clique
->
Cluster
Ngrams
clique2cluster
=
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)
...
...
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