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

[METRICS] TFICF errors && exports

parent 543bad9d
......@@ -15,10 +15,20 @@ TFICF is a generalization of [TFIDF](https://en.wikipedia.org/wiki/Tf%E2%80%93id
{-# LANGUAGE NoImplicitPrelude #-}
module Gargantext.Text.Metrics.TFICF where
module Gargantext.Text.Metrics.TFICF ( TFICF
, TficfContext(..)
, Total(..)
, Count(..)
, tficf
)
where
import Data.Text (Text)
import Gargantext.Prelude
path :: Text
path = "Gargantext.Text.Metrics.TFICF"
type TFICF = Double
data TficfContext n m = TficfInfra n m
......@@ -34,7 +44,7 @@ tficf :: TficfContext Count Total
tficf (TficfInfra (Count ic) (Total it) )
(TficfSupra (Count sc) (Total st) )
| it >= ic && st >= sc = (ic/it) / log (sc/st)
| otherwise = panic "Frequency impossible"
tficf _ _ = panic "Undefined for these contexts"
| otherwise = panic $ "[ERR]" <> path <>" Frequency impossible"
tficf _ _ = panic $ "[ERR]" <> path <> "Undefined for these contexts"
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