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
200
Issues
200
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
6af8ff7b
Commit
6af8ff7b
authored
May 22, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Ngrams] cosmetics.
parent
8b76e18c
Pipeline
#404
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
Eleve.hs
src/Gargantext/Text/Eleve.hs
+8
-7
No files found.
src/Gargantext/Text/Eleve.hs
View file @
6af8ff7b
...
@@ -25,19 +25,19 @@ example = map terminal
...
@@ -25,19 +25,19 @@ example = map terminal
$
chunkAlong
3
1
$
chunkAlong
3
1
$
words
"New York and New York is a big apple"
$
words
"New York and New York is a big apple"
data
Terminal
=
Debut
|
Terminal
Text
|
Fin
data
Terminal
=
Terminal
Text
|
Fin
deriving
(
Ord
,
Eq
,
Show
)
deriving
(
Ord
,
Eq
,
Show
)
isDebutFin
::
Terminal
->
Bool
isFin
::
Terminal
->
Bool
isDebutFin
x
=
case
x
of
isFin
x
=
case
x
of
Debut
->
True
Fin
->
True
Fin
->
True
_
->
False
_
->
False
terminal
::
[
Text
]
->
[
Terminal
]
terminal
::
[
Text
]
->
[
Terminal
]
--terminal xs = [Debut] <> (map Terminal xs) <> [Fin]
terminal
xs
=
(
map
Terminal
xs
)
<>
[
Fin
]
terminal
xs
=
(
map
Terminal
xs
)
<>
[
Fin
]
data
Arbre
k
e
=
Noeud
{
_noeud_count
::
Double
data
Arbre
k
e
=
Noeud
{
_noeud_count
::
Double
,
_noeud_entropy
::
e
,
_noeud_entropy
::
e
,
_noeud_fils
::
Map
k
(
Arbre
k
e
)
,
_noeud_fils
::
Map
k
(
Arbre
k
e
)
...
@@ -69,7 +69,7 @@ entropyArbre :: Arbre Terminal () -> Arbre Terminal Double
...
@@ -69,7 +69,7 @@ entropyArbre :: Arbre Terminal () -> Arbre Terminal Double
entropyArbre
(
Feuille
c
)
=
Feuille
c
entropyArbre
(
Feuille
c
)
=
Feuille
c
entropyArbre
(
Noeud
c
_e
fils
)
=
(
Noeud
c
e
(
map
entropyArbre
fils
))
entropyArbre
(
Noeud
c
_e
fils
)
=
(
Noeud
c
e
(
map
entropyArbre
fils
))
where
where
e
=
sum
$
map
(
\
(
k
,
f
)
->
case
is
Debut
Fin
k
of
e
=
sum
$
map
(
\
(
k
,
f
)
->
case
isFin
k
of
True
->
(
_noeud_count
f
)
/
c
*
log
c
True
->
(
_noeud_count
f
)
/
c
*
log
c
False
->
-
c'
*
log
c'
False
->
-
c'
*
log
c'
where
where
...
@@ -79,7 +79,7 @@ entropyArbre (Noeud c _e fils) = (Noeud c e (map entropyArbre fils))
...
@@ -79,7 +79,7 @@ entropyArbre (Noeud c _e fils) = (Noeud c e (map entropyArbre fils))
normalizeArbre
::
Arbre
Terminal
Double
->
Arbre
Terminal
Double
normalizeArbre
::
Arbre
Terminal
Double
->
Arbre
Terminal
Double
normalizeArbre
(
Feuille
c
)
=
Feuille
c
normalizeArbre
(
Feuille
c
)
=
Feuille
c
normalizeArbre
(
Noeud
c
e
f
)
=
Noeud
c
e
(
Map
.
map
(
\
n
->
normalizeLevel
n
$
Map
.
elems
f
)
f
)
normalizeArbre
(
Noeud
c
e
f
)
=
Noeud
c
e
(
Map
.
map
(
\
a
->
normalizeLevel
a
$
Map
.
elems
f
)
f
)
normalizeLevel
::
Arbre
Terminal
Double
->
[
Arbre
Terminal
Double
]
->
Arbre
Terminal
Double
normalizeLevel
::
Arbre
Terminal
Double
->
[
Arbre
Terminal
Double
]
->
Arbre
Terminal
Double
normalizeLevel
(
Feuille
c
)
_
=
Feuille
c
normalizeLevel
(
Feuille
c
)
_
=
Feuille
c
...
@@ -95,3 +95,4 @@ buildArbre = normalizeArbre . entropyArbre . insertArbres
...
@@ -95,3 +95,4 @@ buildArbre = normalizeArbre . entropyArbre . insertArbres
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