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
547bb10c
Unverified
Commit
547bb10c
authored
Jun 11, 2019
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ElEve..
parent
910bdf96
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
23 deletions
+18
-23
Eleve.hs
src/Gargantext/Text/Eleve.hs
+18
-23
No files found.
src/Gargantext/Text/Eleve.hs
View file @
547bb10c
...
@@ -41,7 +41,7 @@ Notes for current implementation:
...
@@ -41,7 +41,7 @@ Notes for current implementation:
module
Gargantext.Text.Eleve
where
module
Gargantext.Text.Eleve
where
import
Debug.Trace
(
trace
)
--
import Debug.Trace (trace)
-- import Debug.SimpleReflect
-- import Debug.SimpleReflect
import
Data.Functor.Reverse
import
Data.Functor.Reverse
...
@@ -234,9 +234,6 @@ class IsTrie trie where
...
@@ -234,9 +234,6 @@ class IsTrie trie where
nodeEntropy
::
Entropy
e
=>
Getting
e
i
e
->
trie
k
i
->
e
nodeEntropy
::
Entropy
e
=>
Getting
e
i
e
->
trie
k
i
->
e
nodeChild
::
Ord
k
=>
k
->
trie
k
e
->
trie
k
e
nodeChild
::
Ord
k
=>
k
->
trie
k
e
->
trie
k
e
findTrie
::
Ord
k
=>
[
k
]
->
trie
k
e
->
trie
k
e
findTrie
::
Ord
k
=>
[
k
]
->
trie
k
e
->
trie
k
e
normalizeEntropy
::
Entropy
e
=>
Getting
e
i
e
->
ModEntropy
i
o
e
->
trie
k
i
->
trie
k
o
-- UNUSED
-- UNUSED
--nodeAutonomy :: (Ord k, Entropy e) => Getting e i e -> trie k i -> [k] -> e
--nodeAutonomy :: (Ord k, Entropy e) => Getting e i e -> trie k i -> [k] -> e
...
@@ -253,17 +250,20 @@ instance IsTrie Trie where
...
@@ -253,17 +250,20 @@ instance IsTrie Trie where
findTrie
ks
t
=
L
.
foldl
(
flip
nodeChild
)
t
ks
findTrie
ks
t
=
L
.
foldl
(
flip
nodeChild
)
t
ks
normalizeEntropy
inE
modE
t
=
trace
(
show
level
)
$
go
(
modE
identity
)
level
t
normalizeEntropy
::
Entropy
e
where
=>
Getting
e
i
e
->
ModEntropy
i
o
e
level
=
(
entropyLevels
inE
t
)
->
Trie
k
i
->
Trie
k
o
go
_
[]
_
=
panic
"normalizeEntropy' empty levels"
normalizeEntropy
inE
modE
t
=
go
(
modE
identity
)
level
t
go
_
_
(
Leaf
c
)
=
Leaf
c
where
level
=
(
entropyLevels
inE
t
)
go
_
[]
_
=
panic
"normalizeEntropy' empty levels"
go
_
_
(
Leaf
c
)
=
Leaf
c
-- go _ ([] : _) _ = panic "normalizeEntropy': empty level"
-- go _ ([] : _) _ = panic "normalizeEntropy': empty level"
go
f
(
es
:
ess
)
(
Node
c
i
children
)
go
f
(
es
:
ess
)
(
Node
c
i
children
)
-- | any (sim (i ^. inE)) es
-- | any (sim (i ^. inE)) es
=
Node
c
(
f
i
)
$
go
(
modE
$
normalizeLevel
es
)
ess
<$>
children
=
Node
c
(
f
i
)
$
go
(
modE
$
normalizeLevel
es
)
ess
<$>
children
-- | otherwise
-- | otherwise
-- = panic "NOT an elem"
-- = panic "NOT an elem"
{-
{-
...
@@ -323,11 +323,6 @@ instance IsTrie Tries where
...
@@ -323,11 +323,6 @@ instance IsTrie Tries where
nodeChild
k
(
Tries
fwd
bwd
)
=
Tries
(
nodeChild
k
fwd
)
(
nodeChild
k
bwd
)
nodeChild
k
(
Tries
fwd
bwd
)
=
Tries
(
nodeChild
k
fwd
)
(
nodeChild
k
bwd
)
normalizeEntropy
inE
modE
=
onTries
(
normalizeEntropy
inE
modE
)
onTries
::
(
Trie
k
i
->
Trie
k
o
)
->
Tries
k
i
->
Tries
k
o
onTries
f
(
Tries
fwd
bwd
)
=
Tries
(
f
fwd
)
(
f
bwd
)
------------------------------------------------------------------------
------------------------------------------------------------------------
split
::
(
IsTrie
trie
,
Entropy
e
)
=>
Lens'
i
e
->
trie
Token
i
->
[
Token
]
->
[[
Token
]]
split
::
(
IsTrie
trie
,
Entropy
e
)
=>
Lens'
i
e
->
trie
Token
i
->
[
Token
]
->
[[
Token
]]
split
_
_
[]
=
[]
split
_
_
[]
=
[]
...
@@ -440,16 +435,16 @@ testEleve debug n output checks = do
...
@@ -440,16 +435,16 @@ testEleve debug n output checks = do
P
.
putStrLn
(
show
input
)
P
.
putStrLn
(
show
input
)
-- forM_ pss (P.putStrLn . show)
-- forM_ pss (P.putStrLn . show)
P
.
putStrLn
""
P
.
putStrLn
""
P
.
putStrLn
"Levels:"
forM_
(
entropyLevels
identity
(
_fwd
t
))
$
\
level
->
P
.
putStrLn
$
" "
<>
show
level
P
.
putStrLn
""
P
.
putStrLn
"Forward:"
P
.
putStrLn
"Forward:"
printTrie
(
_fwd
t
)
printTrie
(
_fwd
t
)
P
.
putStrLn
""
P
.
putStrLn
""
P
.
putStrLn
"Backward:"
P
.
putStrLn
"Backward:"
printTrie
(
_bwd
t
)
printTrie
(
_bwd
t
)
P
.
putStrLn
""
P
.
putStrLn
""
P
.
putStrLn
"Levels:"
forM_
(
entropyLevels
identity
t''
)
$
\
level
->
P
.
putStrLn
$
" "
<>
show
level
P
.
putStrLn
""
P
.
putStrLn
"Normalized:"
P
.
putStrLn
"Normalized:"
printTrie
nt
printTrie
nt
P
.
putStrLn
""
P
.
putStrLn
""
...
...
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