Commit 67c34520 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[LIST] improved for candidates

parent 65f36dec
......@@ -256,42 +256,50 @@ buildNgramsTermsList user uCid mCid groupParams (nt, _mapListSize)= do
-- splitAt
let
-- use % of list if to big, or Int if to small
listSizeLocal = 1000 :: Double
mapSize = 1000 :: Double
canSize = mapSize * 10 :: Double
inclSize = 0.4 :: Double
exclSize = 1 - inclSize
splitAt' max' n' = (both (HashMap.fromList)) . (List.splitAt (round $ n' * max'))
sortOn f = (List.sortOn (Down . (view (gts'_score . f)) . snd)) . HashMap.toList
monoInc_size n = splitAt' n $ monoSize * inclSize / 2
multExc_size n = splitAt' n $ multSize * exclSize / 2
(mapMonoScoredInclHead, monoScoredInclTail) = monoInc_size mapSize $ (sortOn scored_genInc) monoScoredIncl
(mapMonoScoredExclHead, monoScoredExclTail) = monoInc_size mapSize $ (sortOn scored_speExc) monoScoredExcl
(mapMultScoredInclHead, multScoredInclTail) = multExc_size mapSize $ (sortOn scored_genInc) multScoredIncl
(mapMultScoredExclHead, multScoredExclTail) = multExc_size mapSize $ (sortOn scored_speExc) multScoredExcl
monoInc_size = splitAt' listSizeLocal $ monoSize * inclSize / 2
(monoScoredInclHead, monoScoredInclTail) = monoInc_size $ (sortOn scored_genInc) monoScoredIncl
(monoScoredExclHead, _monoScoredExclTail) = monoInc_size $ (sortOn scored_speExc) monoScoredExcl
multExc_size = splitAt' listSizeLocal $ multSize * exclSize / 2
(multScoredInclHead, multScoredInclTail) = multExc_size $ (sortOn scored_genInc) multScoredIncl
(multScoredExclHead, multScoredExclTail) = multExc_size $ (sortOn scored_speExc) multScoredExcl
(canMonoScoredIncHead , _) = monoInc_size canSize $ (sortOn scored_genInc) monoScoredInclTail
(canMonoScoredExclHead, _) = monoInc_size canSize $ (sortOn scored_speExc) monoScoredExclTail
(candidatesHead, _candidatesTail) = splitAt' 4000 (0.5 :: Double)
$ sortOn scored_genInc
$ monoScoredInclTail
<> multScoredInclTail
<> multScoredExclTail
printDebug "stopWords" stopTerms
(canMulScoredInclHead, _) = multExc_size canSize $ (sortOn scored_genInc) multScoredInclTail
(canMultScoredExclHead, _) = multExc_size canSize $ (sortOn scored_speExc) multScoredExclTail
------------------------------------------------------------
-- Final Step building the Typed list
-- Candidates Terms need to be filtered
let
maps = setListType (Just MapTerm)
$ monoScoredInclHead
<> monoScoredExclHead
<> multScoredInclHead
<> multScoredExclHead
$ mapMonoScoredInclHead
<> mapMonoScoredExclHead
<> mapMultScoredInclHead
<> mapMultScoredExclHead
-- An original way to filter to start with
cands = setListType (Just CandidateTerm) candidatesHead
cands = setListType (Just CandidateTerm)
$ canMonoScoredIncHead
<> canMonoScoredExclHead
<> canMulScoredInclHead
<> canMultScoredExclHead
-- TODO count it too
cands' = setListType (Just CandidateTerm)
{-$ groupedMonoTail
<>-} groupedMultTail
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment