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
4a25b912
Commit
4a25b912
authored
Apr 27, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TYPE] semantics, renaming
parent
17f1d540
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
15 deletions
+15
-15
Tools.hs
src/Gargantext/API/Ngrams/Tools.hs
+2
-2
Examples.hs
src/Gargantext/Core/Text/Examples.hs
+2
-2
Metrics.hs
src/Gargantext/Core/Text/Metrics.hs
+2
-2
Index.hs
src/Gargantext/Core/Viz/Graph/Index.hs
+5
-5
Tools.hs
src/Gargantext/Core/Viz/Graph/Tools.hs
+4
-4
No files found.
src/Gargantext/API/Ngrams/Tools.hs
View file @
4a25b912
...
...
@@ -91,7 +91,7 @@ filterListWithRootHashMap lt m = snd <$> HM.filter isMapTerm m
isMapTerm
(
l
,
maybeRoot
)
=
case
maybeRoot
of
Nothing
->
l
==
lt
Just
r
->
case
HM
.
lookup
r
m
of
Nothing
->
panic
$
"
Garg.API.Ngrams.Tools:
filterWithRoot, unknown key: "
<>
unNgramsTerm
r
Nothing
->
panic
$
"
[Garg.API.Ngrams.Tools]
filterWithRoot, unknown key: "
<>
unNgramsTerm
r
Just
(
l'
,
_
)
->
l'
==
lt
filterListWithRoot
::
ListType
...
...
@@ -102,7 +102,7 @@ filterListWithRoot lt m = snd <$> HM.filter isMapTerm m
isMapTerm
(
l
,
maybeRoot
)
=
case
maybeRoot
of
Nothing
->
l
==
lt
Just
r
->
case
HM
.
lookup
r
m
of
Nothing
->
panic
$
"
Garg.API.Ngrams.Tools:
filterWithRoot, unknown key: "
<>
unNgramsTerm
r
Nothing
->
panic
$
"
[Garg.API.Ngrams.Tools]
filterWithRoot, unknown key: "
<>
unNgramsTerm
r
Just
(
l'
,
_
)
->
l'
==
lt
groupNodesByNgrams
::
(
At
root_map
...
...
src/Gargantext/Core/Text/Examples.hs
View file @
4a25b912
...
...
@@ -112,7 +112,7 @@ ex_cooc_mat :: IO (Map Label Index, Matrix Int, Matrix Double, (DAA.Vector Gener
ex_cooc_mat
=
do
m
<-
ex_cooc
let
(
ti
,
_
)
=
createIndices
m
let
mat_cooc
=
cooc2mat
Triang
ular
ti
m
let
mat_cooc
=
cooc2mat
Triang
le
ti
m
pure
(
ti
,
mat_cooc
,
incExcSpeGen_proba
mat_cooc
...
...
@@ -123,7 +123,7 @@ ex_incExcSpeGen :: IO ([(Label, Double)], [(Label, Double)])
ex_incExcSpeGen
=
incExcSpeGen_sorted
<$>
ex_cooc
incExcSpeGen_sorted
::
Ord
t
=>
Map
(
t
,
t
)
Int
->
([(
t
,
Double
)],[(
t
,
Double
)])
incExcSpeGen_sorted
m
=
both
ordonne
(
incExcSpeGen
$
cooc2mat
Triang
ular
ti
m
)
incExcSpeGen_sorted
m
=
both
ordonne
(
incExcSpeGen
$
cooc2mat
Triang
le
ti
m
)
where
(
ti
,
fi
)
=
createIndices
m
ordonne
x
=
sortWith
(
Down
.
snd
)
...
...
src/Gargantext/Core/Text/Metrics.hs
View file @
4a25b912
...
...
@@ -70,7 +70,7 @@ localMetrics' m = Map.fromList $ zipWith (\(_,t) (inc,spe) -> (t, Vec.fromList [
scores
where
(
ti
,
fi
)
=
createIndices
m
(
is
,
ss
)
=
incExcSpeGen
$
cooc2mat
Triang
ular
ti
m
(
is
,
ss
)
=
incExcSpeGen
$
cooc2mat
Triang
le
ti
m
scores
=
DAA
.
toList
$
DAA
.
run
$
DAA
.
zip
(
DAA
.
use
is
)
(
DAA
.
use
ss
)
...
...
@@ -82,7 +82,7 @@ scored' :: Ord t => Map (t,t) Int -> [Scored t]
scored'
m
=
zipWith
(
\
(
_
,
t
)
(
inc
,
spe
)
->
Scored
t
inc
spe
)
(
Map
.
toList
fi
)
scores
where
(
ti
,
fi
)
=
createIndices
m
(
is
,
ss
)
=
incExcSpeGen
$
cooc2mat
Triang
ular
ti
m
(
is
,
ss
)
=
incExcSpeGen
$
cooc2mat
Triang
le
ti
m
scores
=
DAA
.
toList
$
DAA
.
run
$
DAA
.
zip
(
DAA
.
use
is
)
(
DAA
.
use
ss
)
...
...
src/Gargantext/Core/Viz/Graph/Index.hs
View file @
4a25b912
...
...
@@ -60,17 +60,17 @@ cooc2mat sym ti m = map2mat sym 0 n idx
n
=
M
.
size
ti
idx
=
toIndex
ti
m
-- it is important to make sure that toIndex is ran only once.
data
MatrixShape
=
Triang
ular
|
Square
data
MatrixShape
=
Triang
le
|
Square
map2mat
::
Elt
a
=>
MatrixShape
->
a
->
Int
->
Map
(
Index
,
Index
)
a
->
Matrix
a
map2mat
sym
def
n
m
=
A
.
fromFunction
shape
getData
where
getData
=
(
\
(
Z
:.
x
:.
y
)
->
case
sym
of
Triang
ular
->
fromMaybe
def
(
M
.
lookup
(
x
,
y
)
m
)
Square
->
fromMaybe
(
fromMaybe
def
$
M
.
lookup
(
y
,
x
)
m
)
$
M
.
lookup
(
x
,
y
)
m
)
Triang
le
->
fromMaybe
def
(
M
.
lookup
(
x
,
y
)
m
)
Square
->
fromMaybe
(
fromMaybe
def
$
M
.
lookup
(
y
,
x
)
m
)
$
M
.
lookup
(
x
,
y
)
m
)
shape
=
(
Z
:.
n
:.
n
)
mat2map
::
(
Elt
a
,
Shape
(
Z
:.
Index
))
=>
...
...
src/Gargantext/Core/Viz/Graph/Tools.hs
View file @
4a25b912
...
...
@@ -57,8 +57,8 @@ cooc2graph' distance threshold myCooc
$
mat2map
$
measure
distance
$
case
distance
of
Conditional
->
map2mat
Triang
ular
0
tiSize
Distributional
->
map2mat
Square
0
tiSize
Conditional
->
map2mat
Triang
le
0
tiSize
Distributional
->
map2mat
Square
0
tiSize
$
Map
.
filter
(
>
1
)
myCooc'
where
...
...
@@ -85,7 +85,7 @@ cooc2graph'' distance threshold myCooc = neighbouMap
where
(
ti
,
_
)
=
createIndices
myCooc
myCooc'
=
toIndex
ti
myCooc
matCooc
=
map2mat
Triang
ular
0
(
Map
.
size
ti
)
$
Map
.
filter
(
>
1
)
myCooc'
matCooc
=
map2mat
Triang
le
0
(
Map
.
size
ti
)
$
Map
.
filter
(
>
1
)
myCooc'
distanceMat
=
measure
distance
matCooc
neighbouMap
=
filterByNeighbours
threshold
$
mat2map
distanceMat
...
...
@@ -125,7 +125,7 @@ cooc2graphWith' doPartitions distance threshold myCooc = do
tiSize
=
Map
.
size
ti
myCooc'
=
toIndex
ti
theMatrix
matCooc
=
case
distance
of
-- Shape of the Matrix
Conditional
->
map2mat
Triang
ular
0
tiSize
Conditional
->
map2mat
Triang
le
0
tiSize
Distributional
->
map2mat
Square
0
tiSize
$
case
distance
of
-- Removing the Diagonal ?
Conditional
->
Map
.
filterWithKey
(
\
(
a
,
b
)
_
->
a
/=
b
)
...
...
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