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
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
f2de3b66
Unverified
Commit
f2de3b66
authored
Jun 11, 2019
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ElEve..
parent
006ef5b9
Pipeline
#460
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
14 deletions
+13
-14
Eleve.hs
src/Gargantext/Text/Eleve.hs
+13
-14
No files found.
src/Gargantext/Text/Eleve.hs
View file @
f2de3b66
...
...
@@ -200,14 +200,8 @@ entropyTrie pred (Node c () children) = Node c e (map (entropyTrie pred) childre
where
chc
=
fromIntegral
(
_node_count
child
)
/
fromIntegral
c
------------------------------------------------------------------------
normalizeLevel
::
Entropy
e
=>
e
->
[
e
]
->
e
->
e
normalizeLevel
prev
=
go
.
noNaNs
where
go
es
=
\
e
->
((
e
-
prev
)
-
m
)
/
v
where
m
=
mean
es
v
=
deviation
es
normalizeLevel
::
Entropy
e
=>
e
->
e
->
e
->
e
->
e
normalizeLevel
prev
m
v
e
=
((
e
-
prev
)
-
m
)
/
v
{- Unused
...
...
@@ -242,12 +236,12 @@ instance IsTrie Trie where
findTrie
ks
t
=
L
.
foldl
(
flip
nodeChild
)
t
ks
normalizeEntropy
inE
modE
t
=
go
(
modE
identity
)
(
entropy
Levels
inE
t
)
t
normalizeEntropy
inE
modE
t
=
go
(
modE
identity
)
(
normalization
Levels
inE
t
)
t
where
go
_
[]
_
=
panic
"normalizeEntropy' empty levels"
go
_
_
(
Leaf
c
)
=
Leaf
c
go
f
(
es
:
ess
)
(
Node
c
i
children
)
=
Node
c
(
f
i
)
$
go
(
modE
$
normalizeLevel
(
i
^.
inE
)
es
)
ess
<$>
children
go
_
[]
_
=
panic
"normalizeEntropy' empty levels"
go
_
_
(
Leaf
c
)
=
Leaf
c
go
f
(
(
m
,
v
,
_
)
:
ess
)
(
Node
c
i
children
)
=
Node
c
(
f
i
)
$
go
(
modE
$
normalizeLevel
(
i
^.
inE
)
m
v
)
ess
<$>
children
{-
...
...
@@ -277,6 +271,11 @@ levels = L.takeWhile (not . L.null) . L.iterate (L.concatMap subForest) . pure
entropyLevels
::
Entropy
e
=>
Getting
e
i
e
->
Trie
k
i
->
[[
e
]]
entropyLevels
inE
=
fmap
(
noNaNs
.
map
(
nodeEntropy
inE
))
.
levels
normalizationLevels
::
Entropy
e
=>
Getting
e
i
e
->
Trie
k
i
->
[(
e
,
e
,
Int
)]
normalizationLevels
inE
=
fmap
f
.
entropyLevels
inE
where
f
es
=
(
mean
es
,
deviation
es
,
length
es
)
------------------------------------------------------------------------
data
Tries
k
e
=
Tries
...
...
@@ -431,7 +430,7 @@ testEleve debug n output checks = do
printTrie
(
_bwd
nt
)
P
.
putStrLn
""
P
.
putStrLn
"Levels:"
forM_
(
entropy
Levels
identity
t''
)
$
\
level
->
forM_
(
normalization
Levels
identity
t''
)
$
\
level
->
P
.
putStrLn
$
" "
<>
show
level
P
.
putStrLn
""
P
.
putStrLn
"Entropy Var:"
...
...
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