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
145
Issues
145
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
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
10ee6b8d
Commit
10ee6b8d
authored
Aug 20, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[COSMETICS] facto in Prelude.
parent
fc00a623
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
28 deletions
+13
-28
Core.hs
src/Gargantext/Core.hs
+1
-4
Prelude.hs
src/Gargantext/Prelude.hs
+12
-23
TextFlow.hs
src/Gargantext/TextFlow.hs
+0
-1
No files found.
src/Gargantext/Core.hs
View file @
10ee6b8d
{-|
Module : Gargantext.Core
Description :
Description :
Which Natural language is supported ?
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
Here is a longer description of this module, containing some
commentary with @some markup@.
-}
module
Gargantext.Core
...
...
@@ -19,7 +17,6 @@ module Gargantext.Core
-- For simplicity, we suppose text has an homogenous language
data
Lang
=
EN
|
FR
-- | DE | IT | SP
-- EN == english
-- FR == french
...
...
src/Gargantext/Prelude.hs
View file @
10ee6b8d
{-|
Module : Gargantext.Prelude
Description :
Description :
Specific Prelude of the project
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
...
...
@@ -72,18 +72,12 @@ import Text.Show (Show(), show)
import
Text.Read
(
Read
())
import
Data.String.Conversions
(
cs
)
--pf :: (a -> Bool) -> [a] -> [a]
--pf = filter
pr
::
[
a
]
->
[
a
]
pr
=
reverse
--pm :: (a -> b) -> [a] -> [b]
--pm = map
map2
::
(
t
->
b
)
->
[[
t
]]
->
[[
b
]]
map2
fun
=
map
(
map
fun
)
-- Some Statistics sugar functions
-- Exponential Average
eavg
::
[
Double
]
->
Double
eavg
(
x
:
xs
)
=
a
*
x
+
(
1
-
a
)
*
(
eavg
xs
)
...
...
@@ -95,6 +89,7 @@ mean :: Fractional a => [a] -> a
mean
xs
=
if
L
.
null
xs
then
0.0
else
sum
xs
/
fromIntegral
(
length
xs
)
sumMaybe
::
Num
a
=>
[
Maybe
a
]
->
Maybe
a
sumMaybe
=
fmap
sum
.
M
.
sequence
...
...
@@ -187,17 +182,17 @@ trunc' :: Int -> Double -> Double
trunc'
n
x
=
fromIntegral
$
truncate
$
(
x
*
10
^
n
)
bool2int
::
Num
a
=>
Bool
->
a
bool2
int
b
=
case
b
of
True
->
1
False
->
0
------------------------------------------------------------------------
bool2
num
::
Num
a
=>
Bool
->
a
bool2num
True
=
1
bool2num
False
=
0
bool2double
::
Bool
->
Double
bool2double
bool
=
case
bool
of
True
->
1.0
False
->
0.0
bool2double
=
bool2num
bool2int
::
Bool
->
Int
bool2int
=
bool2num
------------------------------------------------------------------------
-- Normalizing && scaling data
scale
::
[
Double
]
->
[
Double
]
...
...
@@ -217,8 +212,6 @@ scaleNormalize xs = map (\x -> (x - v / (m + 1))) xs'
m
=
mean
xs'
xs'
=
map
abs
xs
normalize
::
[
Double
]
->
[
Double
]
normalize
as
=
normalizeWith
identity
as
...
...
@@ -234,10 +227,6 @@ zipFst f xs = zip (f xs) xs
zipSnd
::
([
a
]
->
[
b
])
->
[
a
]
->
[(
a
,
b
)]
zipSnd
f
xs
=
zip
xs
(
f
xs
)
-- Just
unMaybe
::
[
Maybe
a
]
->
[
a
]
unMaybe
=
map
fromJust
.
L
.
filter
isJust
-- | maximumWith
maximumWith
::
(
Ord
a1
,
Foldable
t
)
=>
(
a2
->
a1
)
->
t
a2
->
a2
maximumWith
f
=
L
.
maximumBy
(
compare
`
on
`
f
)
...
...
src/Gargantext/TextFlow.hs
View file @
10ee6b8d
...
...
@@ -51,7 +51,6 @@ import Data.Graph.Clustering.Louvain.CplusPlus (cLouvain, LouvainNode(..))
| |_| | (_| | | | (_| | (_| | | | | || __/> <| |_
\____|\__,_|_| \__, |\__,_|_| |_|\__\___/_/\_\\__|
|___/
-}
printDebug
::
(
Show
a
,
MonadIO
m
)
=>
[
Char
]
->
a
->
m
()
...
...
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