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
ce0f0e64
Commit
ce0f0e64
authored
Feb 15, 2019
by
Quentin Lobbé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add types Fis, Clique and Support
parent
101568d4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
51 deletions
+28
-51
Example.hs
src/Gargantext/Viz/Phylo/Example.hs
+28
-51
No files found.
src/Gargantext/Viz/Phylo/Example.hs
View file @
ce0f0e64
...
...
@@ -32,9 +32,11 @@ import Data.Text (Text, unwords, toLower, words)
import
Data.Tuple.Extra
(
both
)
import
Data.Map
(
Map
)
import
qualified
Data.Map
as
DM
import
qualified
Data.Map
as
Map
import
Data.Set
(
Set
)
import
qualified
Data.Set
as
DS
import
qualified
Data.Matrix
as
DM
'
i
m
port
Gargantext
.
Text
.
Metrics
.
FrequentItemSet
(
fisWithSizePolyMap
,
Size
(
..
))
import
Gargantext.Text.Terms.Mono
(
monoTexts
)
...
...
@@ -59,53 +61,19 @@ type PeriodeSize = Int
type
Occurrences
=
Int
------------------------------------------------------------------------
-- | Phylo'' ?
-- | phylo_id = date && source data && query && [operations]
-- | node_type = 0 | 1 | 2 | 3 <=> root | emergence | recombination | steady
data
Phylo''
a
=
Phylo''
{
phylo_id
::
a
,
branch_list
::
[
Branch
a
]
}
data
Branch
a
=
Branch
{
branch_id
::
Int
,
cluster_list
::
[
Cluster'
a
]
,
cluster_edge
::
[
Edge
a
]
}
data
Cluster'
a
=
Cluster'
{
cluster_node
::
Node
a
,
cluster_date
::
Date
,
term_list
::
[
Node
a
]
,
term_edge
::
[
Edge
a
]
}
data
Edge
a
=
Edge
{
edge_id
::
Int
,
edge_source
::
Node
a
,
edge_target
::
Node
a
}
data
Node
a
=
Node
{
node_id
::
Int
,
node_label
::
Ngrams
,
node_type
::
a
,
node_score
::
a
}
-- | number of Documents in a given Corpus where a set of Ngrams co-occurs
type
Support
=
Int
-- | frequent items set
type
Fis
=
Map
(
Set
Ngrams
)
Support
------------------------------------------------------------------------
-- | Phylo == Phylo' ?
type
Phylo'
a
=
[
Strate
a
]
--------------------------------------------------------------------
data
Strate
a
=
Strate
{
strate_date
::
(
Date
,
Date
)
,
strate_clusters
::
[
Cluster
a
]
}
data
Cluster
a
=
Cluster
{
cluster_id
::
Int
,
cluster_ngrams
::
Set
Ngrams
,
cluster_score
::
a
,
cluster_parent
::
[(
Cluster
a
,
Double
)]
}
data
PhyloField
=
PhyloField
{
phyloField_id
::
Int
}
--------------------------------------------------------------------
----
--------------------------------------------------------------------
phyloExampleFinal
::
Phylo
phyloExampleFinal
=
undefined
...
...
@@ -115,12 +83,21 @@ appariement = undefined
--------------------------------------------------------------------
phyloExample
::
Map
(
Date
,
Date
)
(
Map
(
Set
Ngrams
)
Int
)
phyloExample
=
fis
phyloTerms
fisToFields
::
Fis
->
[
PhyloField
]
fisToFields
=
undefined
fis
::
Map
(
Date
,
Date
)
[
Document
]
->
Map
(
Date
,
Date
)
(
Map
(
Set
Ngrams
)
Int
)
fis
=
phylo
(
words
.
text
)
phyloClusters
::
Map
(
Date
,
Date
)
[
PhyloField
]
phyloClusters
=
undefined
--------------------------------------------------------------------
phyloFis
::
Map
(
Date
,
Date
)
Fis
phyloFis
=
termsToFis
phyloTerms
termsToFis
::
Map
(
Date
,
Date
)
[
Document
]
->
Map
(
Date
,
Date
)
Fis
termsToFis
=
phylo
(
words
.
text
)
phyloTerms
::
Map
(
Date
,
Date
)
[
Document
]
phyloTerms
=
toPeriodes
date
5
3
$
cleanCorpus
mapList
phyloCorpus
...
...
@@ -132,14 +109,14 @@ phyloTerms = toPeriodes date 5 3 $ cleanCorpus mapList phyloCorpus
phylo
::
(
Document
->
[
Ngrams
])
->
Map
(
Date
,
Date
)
[
Document
]
->
Map
(
Date
,
Date
)
(
Map
(
Set
Ngrams
)
Int
)
phylo
f
=
DM
.
map
(
\
d
->
fisWithSizePolyMap
(
Segment
1
20
)
1
(
map
f
d
))
phylo
f
=
Map
.
map
(
\
d
->
fisWithSizePolyMap
(
Segment
1
20
)
1
(
map
f
d
))
------------------------------------------------------------------------
-- | Create a Map of (time steps) and [documents]
toPeriodes
::
(
Ord
date
,
Enum
date
)
=>
(
doc
->
date
)
->
Grain
->
Step
->
[
doc
]
->
Map
(
date
,
date
)
[
doc
]
toPeriodes
_
_
_
[]
=
panic
"Empty corpus can not have any periods"
toPeriodes
f
g
s
es
=
DM
.
fromList
$
zip
hs
$
map
(
inPeriode
f
es
)
hs
toPeriodes
f
g
s
es
=
Map
.
fromList
$
zip
hs
$
map
(
inPeriode
f
es
)
hs
where
hs
=
steps
g
s
$
both
f
(
DL
.
head
es
,
DL
.
last
es
)
------------------------------------------------------------------------
...
...
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