)
where
+import Data.Map.Strict (Map, toList)
import Data.Text (Text)
-import Gargantext.Prelude
-import Data.Set (Set)
import Gargantext.Core.Types (Ordering(..))
-import Data.Map.Strict (Map, toList)
-import qualified Data.Ord as DO (Down(..))
+import Gargantext.Prelude
import qualified Data.List as List
+import qualified Data.Ord as DO (Down(..))
path :: Text
path = "[G.T.Metrics.TFICF]"
-> TFICF
tficf (TficfInfra (Count ic) (Total it) )
(TficfSupra (Count sc) (Total st) )
- | it >= ic && st >= sc {-&& it <= st-} = (ic/it) / log (sc/st)
- | otherwise = panic $ "[ERR]" <> path <>" Frequency impossible"
+ | it >= ic && st >= sc && it <= st = (it/ic) * log (st/sc)
+ | otherwise = panic
+ $ "[ERR]"
+ <> path
+ <> " Frequency impossible"
tficf _ _ = panic $ "[ERR]" <> path <> "Undefined for these contexts"
sortTficf :: Ordering
- -> (Map Text (Double, Set Text))
- -> [ (Text,(Double, Set Text))]
-sortTficf Down = List.sortOn (DO.Down . fst . snd) . toList
-sortTficf Up = List.sortOn (fst . snd) . toList
+ -> Map Text Double
+ -> [(Text, Double)]
+sortTficf Down = List.sortOn (DO.Down . snd) . toList
+sortTficf Up = List.sortOn snd . toList