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
6071ffb7
Commit
6071ffb7
authored
Mar 14, 2019
by
Quentin Lobbé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding some view functions
parent
c08d6972
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
2 deletions
+40
-2
Example.hs
src/Gargantext/Viz/Phylo/Example.hs
+40
-2
No files found.
src/Gargantext/Viz/Phylo/Example.hs
View file @
6071ffb7
...
...
@@ -68,9 +68,28 @@ import qualified Data.Vector as Vector
------------------------------------------------------------------------
-- | STEP 12 | -- Return a Phylo for upcomming visiualization tasks
-- mostFreqNgramsVerbose :: Int -> [PhyloGroup] -> PhyloNgrams -> Text
-- mostFreqNgramsVerbose thr groups ngrams = unwords $ map (\idx -> ngrams Vector.(!) idx) $ mostFreqNgrams thr groups
-- | To get all the single PhyloPeriodIds covered by a PhyloBranch
getBranchPeriods
::
PhyloBranch
->
[
PhyloPeriodId
]
getBranchPeriods
b
=
nub
$
map
(
fst
.
fst
)
$
getBranchGroupIds
b
-- | To get all the single PhyloPeriodIds covered by a PhyloBranch
getBranchGroupIds
::
PhyloBranch
->
[
PhyloGroupId
]
getBranchGroupIds
b
=
_phylo_branchGroups
b
-- | To transform a list of Ngrams Indexes into a Label
ngramsToLabel
::
[
Int
]
->
PhyloNgrams
->
Text
ngramsToLabel
l
ngrams
=
unwords
$
ngramsToText
l
ngrams
-- | To transform a list of Ngrams Indexes into a list of Text
ngramsToText
::
[
Int
]
->
PhyloNgrams
->
[
Text
]
ngramsToText
l
ngrams
=
map
(
\
idx
->
ngrams
Vector
.!
idx
)
l
-- | To get the nth most frequent Ngrams in a list of PhyloGroups
mostFreqNgrams
::
Int
->
[
PhyloGroup
]
->
[
Int
]
mostFreqNgrams
thr
groups
=
map
fst
$
take
thr
...
...
@@ -81,6 +100,25 @@ mostFreqNgrams thr groups = map fst
$
(
sort
.
concat
)
$
map
getGroupNgrams
groups
-- | To get the (nth `div` 2) most cooccuring Ngrams in a PhyloGroup
mostOccNgrams
::
Int
->
PhyloGroup
->
[
Int
]
mostOccNgrams
thr
group
=
(
nub
.
concat
)
$
map
(
\
((
f
,
s
),
d
)
->
[
f
,
s
])
$
take
(
thr
`
div
`
2
)
$
reverse
$
sortOn
snd
$
Map
.
toList
$
getGroupCooc
group
filterLoneBranches
::
Int
->
Int
->
Int
->
[
PhyloPeriod
]
->
[
PhyloBranch
]
filterLoneBranches
nbPinf
nbPsup
nbG
periods
branches
=
filter
(
not
.
isLone
)
branches
where
isLone
::
PhyloBranch
->
Boolean
isLone
b
=
((
length
.
getBranchGroups
)
b
<=
nbG
)
&&
notElem
((
head
.
getBranchPeriods
)
b
)
(
take
nbPinf
periods
)
&&
notElem
((
head
.
getBranchPeriods
)
b
)
(
take
nbPsup
reverse
periods
)
toPhyloView
::
Level
->
Phylo
->
[
PhyloBranch
]
toPhyloView
lvl
p
=
branchesLbl
where
...
...
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