Commit 4ef15dd7 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[TextFlow] WIP Metrics fixes

parent 38ca4c31
Pipeline #1047 failed with stage
...@@ -141,14 +141,11 @@ buildNgramsTermsList :: Lang ...@@ -141,14 +141,11 @@ buildNgramsTermsList :: Lang
-> Cmd err (Map NgramsType [NgramsElement]) -> Cmd err (Map NgramsType [NgramsElement])
buildNgramsTermsList _l _n _m s uCid mCid = do buildNgramsTermsList _l _n _m s uCid mCid = do
candidates <- sortTficf Down <$> getTficf uCid mCid NgramsTerms candidates <- sortTficf Down <$> getTficf uCid mCid NgramsTerms
printDebug "candidates" (length candidates) printDebug "head candidates" (List.take 10 $ candidates)
printDebug "tail candidates" (List.take 10 $ List.reverse $ candidates)
let let
candidatesSize = 400 candidatesSize = 400
{-
a = 50
b = 50
-}
candidatesHead = List.take candidatesSize candidates candidatesHead = List.take candidatesSize candidates
candidatesTail = List.drop candidatesSize candidates candidatesTail = List.drop candidatesSize candidates
......
...@@ -47,7 +47,7 @@ tficf :: TficfContext Count Total ...@@ -47,7 +47,7 @@ tficf :: TficfContext Count Total
-> TFICF -> TFICF
tficf (TficfInfra (Count ic) (Total it) ) tficf (TficfInfra (Count ic) (Total it) )
(TficfSupra (Count sc) (Total st) ) (TficfSupra (Count sc) (Total st) )
| it >= ic && st >= sc && it <= st = (ic/it) / log (sc/st) | it >= ic && st >= sc && it <= st = (it/ic) * log (st/sc)
| otherwise = panic $ "[ERR]" <> path <>" Frequency impossible" | otherwise = panic $ "[ERR]" <> path <>" Frequency impossible"
tficf _ _ = panic $ "[ERR]" <> path <> "Undefined for these contexts" tficf _ _ = panic $ "[ERR]" <> path <> "Undefined for these contexts"
......
...@@ -238,7 +238,7 @@ insertDocs :: ( FlowCmdM env err m ...@@ -238,7 +238,7 @@ insertDocs :: ( FlowCmdM env err m
insertDocs uId cId hs = do insertDocs uId cId hs = do
let docs = map addUniqId hs let docs = map addUniqId hs
newIds <- insertDb uId cId docs newIds <- insertDb uId cId docs
printDebug "newIds" newIds -- printDebug "newIds" newIds
let let
newIds' = map reId newIds newIds' = map reId newIds
documentsWithId = mergeData (toInserted newIds) (Map.fromList $ map viewUniqId' docs) documentsWithId = mergeData (toInserted newIds) (Map.fromList $ map viewUniqId' docs)
......
...@@ -34,8 +34,8 @@ getTficf :: UserCorpusId ...@@ -34,8 +34,8 @@ getTficf :: UserCorpusId
-> NgramsType -> NgramsType
-> Cmd err (Map Text Double) -> Cmd err (Map Text Double)
getTficf cId mId nt = do getTficf cId mId nt = do
mapTextDoubleLocal <- {- Map.filter (> 1) mapTextDoubleLocal <- Map.filter (> 1)
<$> -} Map.map (fromIntegral . Set.size) <$> Map.map (fromIntegral . Set.size)
<$> getNodesByNgramsUser cId nt <$> getNodesByNgramsUser cId nt
mapTextDoubleGlobal <- Map.map fromIntegral mapTextDoubleGlobal <- Map.map fromIntegral
......
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