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
ac66ef2c
Unverified
Commit
ac66ef2c
authored
Jun 11, 2019
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ElEve...
parent
00787609
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
+16
-17
Eleve.hs
src/Gargantext/Text/Eleve.hs
+16
-17
No files found.
src/Gargantext/Text/Eleve.hs
View file @
ac66ef2c
...
...
@@ -448,10 +448,13 @@ testEleve debug n output checks = do
P
.
putStrLn
$
" "
<>
show
level
P
.
putStrLn
""
P
.
putStrLn
"Forward:"
printTrie
(
_fwd
n
t
)
printTrie
(
_fwd
t
)
P
.
putStrLn
""
P
.
putStrLn
"Backward:"
printTrie
(
_bwd
nt
)
printTrie
(
_bwd
t
)
P
.
putStrLn
""
P
.
putStrLn
"Normalized:"
printTrie
nt
P
.
putStrLn
""
P
.
putStrLn
"Splitting:"
P
.
putStrLn
$
show
res
...
...
@@ -463,22 +466,17 @@ testEleve debug n output checks = do
expected
=
fmap
(
T
.
splitOn
"-"
)
<$>
out
input
=
(
T
.
splitOn
"-"
=<<
)
<$>
out
inp
=
toToken
<$>
input
t
::
Tries
Token
Double
t
=
buildTrie
toToken'
n
input
&
bwd
.
node_children
.
at
(
Terminal
Start
)
.
_Just
.
node_entropy
.~
nan
-- NP: this is a hack to set the bwd entropy of Start at NaN.
--
TODO
NP: this is a hack to set the bwd entropy of Start at NaN.
t''
::
Trie
Token
Double
t''
=
set_entropy_vars
identity
(
\
e
_i
->
e
)
t
-- keeping nt for fwd and bwd checks
-- it has no sense to calculate entropy_var on fwd and bwd each
nt
::
Tries
Token
(
I
Double
)
nt
=
normalizeEntropy
identity
set_autonomy
t
nt
'
::
Trie
Token
(
I
Double
)
nt
'
=
normalizeEntropy
identity
set_autonomy
t''
nt
::
Trie
Token
(
I
Double
)
nt
=
normalizeEntropy
identity
set_autonomy
t''
-- nt = normalizeEntropy identity set_autonomy (fwd :: Trie Token Double)
-- nt = normalizeEntropy' info_entropy (\f -> info_norm_entropy' %~ f) nt
...
...
@@ -491,7 +489,7 @@ testEleve debug n output checks = do
checker
(
ngram
,
count
,
entropy
,
_ev
,
autonomy
,
bwd_entropy
,
fwd_entropy
)
=
do
let
ns
=
parseToken
<$>
T
.
words
ngram
nsb
=
parseToken
<$>
(
reverse
$
T
.
words
ngram
)
t'
=
findTrie
ns
n
t
t'
=
findTrie
ns
t
tvar
=
findTrie
ns
t''
P
.
putStrLn
$
" "
<>
T
.
unpack
ngram
<>
":"
...
...
@@ -504,11 +502,12 @@ testEleve debug n output checks = do
PASS count 1
FAIL entropy ref=NaN my=0.0
-}
check
sim
"autonomy"
autonomy
(
nodeEntropy
info_autonomy
nt'
)
check
sim
"fwd_entropy"
fwd_entropy
(
nodeEntropy
info_entropy
(
_fwd
t'
))
check
sim
"bwd_entropy"
bwd_entropy
(
nodeEntropy
info_entropy
(
_bwd
t'
))
check
sim
"autonomy"
autonomy
(
nodeEntropy
info_autonomy
nt
)
check
sim
"fwd_entropy"
fwd_entropy
(
nodeEntropy
identity
(
_fwd
t'
))
check
sim
"bwd_entropy"
bwd_entropy
(
nodeEntropy
identity
(
_bwd
t'
))
printTrie
::
Show
e
=>
Trie
Token
e
->
IO
()
printTrie
=
P
.
putStrLn
.
Tree
.
drawTree
.
fmap
show
...
...
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