Commit 45d10dd1 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[TEST] uncommenting tests.

parent 48e8772e
Pipeline #448 failed with stage
...@@ -291,7 +291,7 @@ instance IsTrie Tries where ...@@ -291,7 +291,7 @@ instance IsTrie Tries where
-- ^^ -- ^^
-- TODO: here this is tempting to reverse but this is not always what we -- TODO: here this is tempting to reverse but this is not always what we
-- want. See also nodeAutonomy. -- want. See also nodeAutonomy.
-- AD: I also tried to reverse here and I confirm getting unexpected results (whereas VETODO is ok) -- AD: I also tried to reverse here and I confirm getting unexpected results (whereas VETODO FIX below is ok)
-- since recursivity of the function makes the reverse multiple times (I guess) -- since recursivity of the function makes the reverse multiple times (I guess)
nodeChild k (Tries fwd bwd) = Tries (nodeChild k fwd) (nodeChild k bwd) nodeChild k (Tries fwd bwd) = Tries (nodeChild k fwd) (nodeChild k bwd)
...@@ -395,11 +395,11 @@ testEleve debug n output checks = do ...@@ -395,11 +395,11 @@ testEleve debug n output checks = do
pure $ expected == res pure $ expected == res
where where
out = T.words <$> output out = T.words <$> output
expected = fmap (T.splitOn "-") <$> out expected = fmap (T.splitOn "-") <$> out
input = (T.splitOn "-" =<<) <$> out input = (T.splitOn "-" =<<) <$> out
inp = toToken <$> input inp = toToken <$> input
t = buildTrie toToken' n input t = buildTrie toToken' n input
-- nt = normalizeEntropy identity set_autonomy (fwd :: Trie Token Double) -- nt = normalizeEntropy identity set_autonomy (fwd :: Trie Token Double)
-- nt = normalizeEntropy' info_entropy (\f -> info_norm_entropy' %~ f) nt -- nt = normalizeEntropy' info_entropy (\f -> info_norm_entropy' %~ f) nt
nt = normalizeEntropy identity set_autonomy t nt = normalizeEntropy identity set_autonomy t
...@@ -411,8 +411,9 @@ testEleve debug n output checks = do ...@@ -411,8 +411,9 @@ testEleve debug n output checks = do
checker (ngram, count, entropy, _ev, autonomy, bwd_entropy, fwd_entropy) = do checker (ngram, count, entropy, _ev, autonomy, bwd_entropy, fwd_entropy) = do
let ns = parseToken <$> T.words ngram let ns = parseToken <$> T.words ngram
t' = findTrie ns nt
nsb = parseToken <$> (reverse $ T.words ngram) nsb = parseToken <$> (reverse $ T.words ngram)
t' = findTrie ns nt
tb' = findTrie nsb nt tb' = findTrie nsb nt
-- TODO put this Variation Entropy at VETODO mark above maybe in nodeEntropy ? -- TODO put this Variation Entropy at VETODO mark above maybe in nodeEntropy ?
ev = (mean [(nodeEntropy info_entropy (_fwd t')), (nodeEntropy info_entropy (_bwd tb'))]) ev = (mean [(nodeEntropy info_entropy (_fwd t')), (nodeEntropy info_entropy (_bwd tb'))])
...@@ -454,7 +455,7 @@ checks0 = ...@@ -454,7 +455,7 @@ checks0 =
,("and", 1, 0.0, -2.113283334294875, -0.5000000000000002, 0.0, 0.0) ,("and", 1, 0.0, -2.113283334294875, -0.5000000000000002, 0.0, 0.0)
,("<stop>", 0, nan, nan, nan, 0.0, nan) ,("<stop>", 0, nan, nan, nan, 0.0, nan)
{- --{-
,("<start> New", 1, nan, nan, nan, nan, 0.0) ,("<start> New", 1, nan, nan, nan, nan, 0.0)
,("New York", 3, 1.584962500721156, 1.584962500721156, 1.4142135623730951, nan, 1.584962500721156) ,("New York", 3, 1.584962500721156, 1.584962500721156, 1.4142135623730951, nan, 1.584962500721156)
,("York is", 1, 0.0, nan, nan, nan, 0.0) ,("York is", 1, 0.0, nan, nan, nan, 0.0)
......
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