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
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
Christian Merten
haskell-gargantext
Commits
40463188
Commit
40463188
authored
Aug 27, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] some warnings/errors at compilation time. OK.
parent
29959d51
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
9 deletions
+7
-9
TextFlow.hs
src/Gargantext/TextFlow.hs
+6
-8
Matrice.hs
src/Gargantext/Viz/Graph/Distances/Matrice.hs
+1
-1
No files found.
src/Gargantext/TextFlow.hs
View file @
40463188
...
...
@@ -36,7 +36,7 @@ import Gargantext.Core (Lang)
import
Gargantext.Prelude
import
Gargantext.Viz.Graph.Index
(
createIndices
,
toIndex
,
map2mat
,
mat2map
)
import
Gargantext.Viz.Graph.Distances.Matrice
(
distributional
,
measureConditional
)
import
Gargantext.Viz.Graph.Distances.Matrice
(
measureConditional
)
import
Gargantext.Viz.Graph
(
Graph
(
..
),
data2graph
)
import
Gargantext.Text.Metrics.Count
(
cooc
)
import
Gargantext.Text.Metrics
(
filterCooc
,
FilterConfig
(
..
),
Clusters
(
..
),
SampleBins
(
..
),
DefaultValue
(
..
),
MapListSize
(
..
),
InclusionSize
(
..
))
...
...
@@ -58,7 +58,7 @@ import Data.Graph.Clustering.Louvain.CplusPlus (cLouvain, l_community_id)
contextText
::
[
T
.
Text
]
contextText
=
[
"The dog is an animal."
contextText
=
map
T
.
pack
[
"The dog is an animal."
,
"The bird is an animal."
,
"The bird is an animal."
,
"The bird and the dog are an animal."
...
...
@@ -72,14 +72,13 @@ contextText = ["The dog is an animal."
]
-- | Control the flow of text
data
TextFlow
=
CSV
FilePath
|
FullText
FilePath
|
Contexts
[
T
.
Text
]
|
DB
Connection
CorpusId
|
Query
T
.
Text
-- ExtDatabase Query
-- IntDatabase NodeId
textFlow
::
TermType
Lang
->
TextFlow
->
IO
Graph
textFlow
termType
workType
=
do
...
...
@@ -87,7 +86,7 @@ textFlow termType workType = do
FullText
path
->
splitBy
(
Sentences
5
)
<$>
readFile
path
CSV
path
->
readCsvOn
[
csv_title
,
csv_abstract
]
path
Contexts
ctxt
->
pure
ctxt
SQL
con
corpusId
->
catMaybes
<$>
map
(
\
n
->
hyperdataDocumentV3_title
(
node_hyperdata
n
)
<>
hyperdataDocumentV3_abstract
(
node_hyperdata
n
))
<$>
getDocumentsV3WithParentId
con
corpusId
DB
con
corpusId
->
catMaybes
<$>
map
(
\
n
->
hyperdataDocumentV3_title
(
node_hyperdata
n
)
<>
hyperdataDocumentV3_abstract
(
node_hyperdata
n
))
<$>
getDocumentsV3WithParentId
con
corpusId
_
->
undefined
textFlow'
termType
contexts
...
...
@@ -147,7 +146,7 @@ textFlow' termType contexts = do
printDebug
"distanceMat"
distanceMat
--
--let distanceMap = M.filter (>0) $ mat2map distanceMat
let
distanceMap
=
M
.
map
(
\
n
->
1
)
$
M
.
filter
(
>
0
)
$
mat2map
distanceMat
let
distanceMap
=
M
.
map
(
\
_
->
1
)
$
M
.
filter
(
>
0
)
$
mat2map
distanceMat
printDebug
"distanceMap size"
$
M
.
size
distanceMap
printDebug
"distanceMap"
distanceMap
...
...
@@ -160,4 +159,3 @@ textFlow' termType contexts = do
--printDebug "partitions" partitions
pure
$
data2graph
(
M
.
toList
ti
)
myCooc4
distanceMap
partitions
src/Gargantext/Viz/Graph/Distances/Matrice.hs
View file @
40463188
...
...
@@ -227,7 +227,6 @@ conditional' m = (run $ ie $ map fromIntegral $ use m, run $ sg $ map fromIntegr
distributional
::
Matrix
Int
->
Matrix
Double
distributional
m
=
run
$
matMiniMax
$
ri
(
map
fromIntegral
$
use
m
)
where
n
=
dim
m
-- filter m = zipWith (\a b -> max a b) m (transpose m)
...
...
@@ -240,6 +239,7 @@ distributional m = run $ matMiniMax $ ri (map fromIntegral $ use m)
$
zipWith
(
/
)
(
crossProduct
m'
)
(
total
m'
)
total
m''
=
replicate
(
constant
(
Z
:.
n
:.
n
))
$
fold
(
+
)
0
$
fold
(
+
)
0
m''
n
=
dim
m
crossProduct
m'''
=
zipWith
(
*
)
(
cross
m'''
)
(
cross
(
transpose
m'''
))
cross
mat
=
zipWith
(
-
)
(
matSum
n
mat
)
(
mat
)
...
...
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