Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Przemyslaw Kaminski
haskell-gargantext
Commits
519719a9
Commit
519719a9
authored
Jun 11, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WORKFLOW] cleaned, adding data2graph.
parent
54d4ebd0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
8 deletions
+19
-8
Pipeline.hs
src/Gargantext/Pipeline.hs
+15
-6
Graph.hs
src/Gargantext/Viz/Graph.hs
+4
-1
Matrice.hs
src/Gargantext/Viz/Graph/Distances/Matrice.hs
+0
-1
No files found.
src/Gargantext/Pipeline.hs
View file @
519719a9
...
...
@@ -28,12 +28,13 @@ import Gargantext.Prelude
import
Gargantext.Viz.Graph.Index
(
score
,
createIndices
,
toIndex
,
fromIndex
,
cooc2mat
,
mat2map
)
import
Gargantext.Viz.Graph.Distances.Matrice
(
conditional'
,
conditional
)
import
Gargantext.Viz.Graph.Index
(
Index
)
import
Gargantext.Viz.Graph
(
Graph
)
import
Gargantext.Text.Metrics.Count
(
cooc
,
removeApax
)
import
Gargantext.Text.Metrics
import
Gargantext.Text.Terms
(
TermType
(
Multi
,
Mono
),
extractTerms
)
import
Gargantext.Text.Context
(
splitBy
,
SplitContext
(
Sentences
))
import
Data.Graph.Clustering.Louvain.CplusPlus
(
cLouvain
)
import
Data.Graph.Clustering.Louvain.CplusPlus
(
cLouvain
,
LouvainNode
)
{-
...
...
@@ -46,6 +47,12 @@ import Data.Graph.Clustering.Louvain.CplusPlus (cLouvain)
-}
-----------------------------------------------------------
data2graph
::
Map
(
Int
,
Int
)
Int
->
Map
(
Int
,
Int
)
Double
->
[
LouvainNode
]
->
Graph
data2graph
=
undefined
-----------------------------------------------------------
workflow
lang
path
=
do
-- Text <- IO Text <- FilePath
text
<-
readFile
path
...
...
@@ -55,14 +62,16 @@ workflow lang path = do
-- TODO filter (\t -> not . elem t stopList) myterms
-- TODO groupBy (Stem | GroupList)
-- @np FIXME optimization issue of filterCooc (too much memory consumed)
let
myCooc
=
filterCooc
$
removeApax
$
cooc
myterms
--pure myCooc
-- Cooc -> Matrix
--let (ti, fi) = createIndices myCooc
-- @np FIXME optimization issue of filterCooc (too much memory consumed)
pure
myCooc
let
(
ti
,
_
)
=
createIndices
myCooc
-- Matrix -> Clustering
-- pure $ bestpartition False $ map2graph
$ toIndex ti myCooc
--partitions <- cLouvain $ toIndex ti $ M.map (\v -> (fromIntegral v) :: Double) myCooc
let
distance
=
score
conditional
$
toIndex
ti
myCooc
partitions
<-
cLouvain
distance
--pure partitions
---- | Building : -> Graph -> JSON
pure
partitions
--pure $ data2graph myCooc distance partitions
src/Gargantext/Viz/Graph.hs
View file @
519719a9
...
...
@@ -19,11 +19,14 @@ module Gargantext.Viz.Graph
import
GHC.Generics
(
Generic
)
import
Data.Aeson.TH
(
deriveJSON
)
import
Data.Text
(
Text
)
import
Data.Map
(
Map
)
import
Gargantext.Prelude
import
Gargantext.Core.Utils.Prefix
(
unPrefix
)
-----------------------------------------------------------
import
Data.Graph.Clustering.Louvain.CplusPlus
(
LouvainNode
)
data
TypeNode
=
Terms
|
Unknown
deriving
(
Show
,
Generic
)
...
...
src/Gargantext/Viz/Graph/Distances/Matrice.hs
View file @
519719a9
...
...
@@ -109,7 +109,6 @@ conditional m = run (miniMax $ proba (dim m) $ map fromIntegral $ use m)
conditional'
::
Matrix
Int
->
(
Matrix
InclusionExclusion
,
Matrix
SpecificityGenericity
)
conditional'
m
=
(
run
$
ie
$
map
fromIntegral
$
use
m
,
run
$
sg
$
map
fromIntegral
$
use
m
)
where
ie
::
Acc
(
Matrix
Double
)
->
Acc
(
Matrix
Double
)
ie
mat
=
map
(
\
x
->
x
/
(
2
*
n
-
1
))
$
zipWith
(
+
)
(
xs
mat
)
(
ys
mat
)
sg
::
Acc
(
Matrix
Double
)
->
Acc
(
Matrix
Double
)
...
...
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