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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
0c34e661
Commit
0c34e661
authored
Oct 12, 2020
by
qlobbe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix number of digit
parent
1576eafc
Pipeline
#1136
canceled with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
PhyloMaker.hs
src/Gargantext/Core/Viz/Phylo/PhyloMaker.hs
+2
-1
PhyloTools.hs
src/Gargantext/Core/Viz/Phylo/PhyloTools.hs
+12
-0
No files found.
src/Gargantext/Core/Viz/Phylo/PhyloMaker.hs
View file @
0c34e661
...
@@ -290,7 +290,8 @@ docsToLastTermFreq :: Int -> [Document] -> Vector Ngrams -> Map Int Double
...
@@ -290,7 +290,8 @@ docsToLastTermFreq :: Int -> [Document] -> Vector Ngrams -> Map Int Double
docsToLastTermFreq
n
docs
fdt
=
docsToLastTermFreq
n
docs
fdt
=
let
last
=
take
n
$
reverse
$
sort
$
map
date
docs
let
last
=
take
n
$
reverse
$
sort
$
map
date
docs
nbDocs
=
fromIntegral
$
length
$
filter
(
\
d
->
elem
(
date
d
)
last
)
docs
nbDocs
=
fromIntegral
$
length
$
filter
(
\
d
->
elem
(
date
d
)
last
)
docs
freqs
=
map
(
/
(
nbDocs
))
freqs
=
map
(
\
x
->
truncate'
(
x
/
nbDocs
)
4
)
-- $ map (/(nbDocs))
$
fromList
$
fromList
$
map
(
\
lst
->
(
head'
"docsToLastTermFreq"
lst
,
fromIntegral
$
length
lst
))
$
map
(
\
lst
->
(
head'
"docsToLastTermFreq"
lst
,
fromIntegral
$
length
lst
))
$
group
$
sort
$
concat
$
map
(
\
d
->
nub
$
ngramsToIdx
(
text
d
)
fdt
)
$
filter
(
\
d
->
elem
(
date
d
)
last
)
docs
$
group
$
sort
$
concat
$
map
(
\
d
->
nub
$
ngramsToIdx
(
text
d
)
fdt
)
$
filter
(
\
d
->
elem
(
date
d
)
last
)
docs
...
...
src/Gargantext/Core/Viz/Phylo/PhyloTools.hs
View file @
0c34e661
...
@@ -19,6 +19,8 @@ import Data.Map (Map, elems, fromList, unionWith, keys, member, (!), filterWithK
...
@@ -19,6 +19,8 @@ import Data.Map (Map, elems, fromList, unionWith, keys, member, (!), filterWithK
import
Data.String
(
String
)
import
Data.String
(
String
)
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Prelude
(
floor
)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Gargantext.Core.Viz.AdaptativePhylo
import
Gargantext.Core.Viz.AdaptativePhylo
import
Text.Printf
import
Text.Printf
...
@@ -56,6 +58,16 @@ printIOComment cmt =
...
@@ -56,6 +58,16 @@ printIOComment cmt =
-- | Misc | --
-- | Misc | --
--------------
--------------
-- truncate' :: Double -> Int -> Double
-- truncate' x n = (fromIntegral (floor (x * t))) / t
-- where t = 10^n
truncate'
::
Double
->
Int
->
Double
truncate'
x
n
=
(
fromIntegral
$
(
floor
(
x
*
t
)
::
Int
))
/
t
where
--------------
t
::
Double
t
=
10
^
n
roundToStr
::
(
PrintfArg
a
,
Floating
a
)
=>
Int
->
a
->
String
roundToStr
::
(
PrintfArg
a
,
Floating
a
)
=>
Int
->
a
->
String
roundToStr
=
printf
"%0.*f"
roundToStr
=
printf
"%0.*f"
...
...
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