From 71868c10c5930e2d74719ed5cfcbf863a1a4a866 Mon Sep 17 00:00:00 2001 From: armatthews Date: Wed, 4 Feb 2015 19:02:18 -0500 Subject: Updated tests for lattice input --- decoder/hg_test.cc | 2 +- tests/system_tests/lattice/gold.statistics | 15 +++++++++++---- tests/system_tests/lattice/gold.stdout | 27 ++++++++++++++++++++++----- tests/system_tests/lattice/input.txt | 1 + tests/system_tests/lattice/lattice.scfg | 1 + tests/system_tests/lattice/weights | 3 ++- 6 files changed, 38 insertions(+), 11 deletions(-) diff --git a/decoder/hg_test.cc b/decoder/hg_test.cc index ec91cd3b..a597ad8d 100644 --- a/decoder/hg_test.cc +++ b/decoder/hg_test.cc @@ -256,7 +256,7 @@ BOOST_AUTO_TEST_CASE(PLF) { string inplf = "((('haupt',-2.06655,1),('hauptgrund',-5.71033,2),),(('grund',-1.78709,1),),(('für\\'',0.1,1),),)"; HypergraphIO::ReadFromPLF(inplf, &hg); SparseVector wts; - wts.set_value(FD::Convert("LatticeCost"), 1.0); + wts.set_value(FD::Convert("LatticeCost_0"), 1.0); hg.Reweight(wts); hg.PrintGraphviz(); string outplf = HypergraphIO::AsPLF(hg); diff --git a/tests/system_tests/lattice/gold.statistics b/tests/system_tests/lattice/gold.statistics index 302ddf14..f3a72022 100644 --- a/tests/system_tests/lattice/gold.statistics +++ b/tests/system_tests/lattice/gold.statistics @@ -1,7 +1,14 @@ -lm_nodes 6 --lm_edges 10 --lm_paths 5 +-lm_edges 16 +-lm_paths 14 +lm_nodes 6 -+lm_edges 10 -+lm_paths 5 ++lm_edges 16 ++lm_paths 14 +lm_trans ab +-lm_nodes 3 +-lm_edges 10 +-lm_paths 8 ++lm_nodes 3 ++lm_edges 10 ++lm_paths 8 ++lm_trans d' diff --git a/tests/system_tests/lattice/gold.stdout b/tests/system_tests/lattice/gold.stdout index 1adb51f1..b5377c1f 100644 --- a/tests/system_tests/lattice/gold.stdout +++ b/tests/system_tests/lattice/gold.stdout @@ -1,5 +1,22 @@ -0 ||| ab ||| SourceWordPenalty=-0.434294 WordPenalty=-0.434294 Cost=0.1 LatticeCost=0.125 ||| -1.09359 -0 ||| cb ||| SourceWordPenalty=-0.868589 WordPenalty=-0.434294 Cost=0.3 LatticeCost=2.25 ||| -3.85288 -0 ||| a_b ||| SourceWordPenalty=-0.868589 WordPenalty=-0.434294 Cost=0.2 LatticeCost=2.5 ||| -4.00288 -0 ||| a' b ||| Glue=1 SourceWordPenalty=-0.868589 WordPenalty=-0.868589 Cost=0.3 LatticeCost=2.5 ||| -4.53718 -0 ||| a b ||| Glue=1 SourceWordPenalty=-0.868589 WordPenalty=-0.868589 Cost=0.3 LatticeCost=2.5 ||| -4.53718 +0 ||| ab ||| SourceWordPenalty=-0.434294 WordPenalty=-0.434294 Cost=0.1 LatticeCost_0=0.125 ||| -1.09359 +0 ||| ab ||| SourceWordPenalty=-0.434294 WordPenalty=-0.434294 Cost=0.1 LatticeCost_0=0.125 ||| -1.09359 +0 ||| cb ||| SourceWordPenalty=-0.868589 WordPenalty=-0.434294 Cost=0.3 LatticeCost_0=2.25 ||| -3.85288 +0 ||| cb ||| SourceWordPenalty=-0.868589 WordPenalty=-0.434294 Cost=0.3 LatticeCost_0=2.25 ||| -3.85288 +0 ||| a_b ||| SourceWordPenalty=-0.868589 WordPenalty=-0.434294 Cost=0.2 LatticeCost_0=2.5 ||| -4.00288 +0 ||| a_b ||| SourceWordPenalty=-0.868589 WordPenalty=-0.434294 Cost=0.2 LatticeCost_0=2.5 ||| -4.00288 +0 ||| a b ||| Glue=1 SourceWordPenalty=-0.868589 WordPenalty=-0.868589 Cost=0.3 LatticeCost_0=2.5 ||| -4.53718 +0 ||| a b ||| Glue=1 SourceWordPenalty=-0.868589 WordPenalty=-0.868589 Cost=0.3 LatticeCost_0=2.5 ||| -4.53718 +0 ||| a b ||| Glue=1 SourceWordPenalty=-0.868589 WordPenalty=-0.868589 Cost=0.3 LatticeCost_0=2.5 ||| -4.53718 +0 ||| a' b ||| Glue=1 SourceWordPenalty=-0.868589 WordPenalty=-0.868589 Cost=0.3 LatticeCost_0=2.5 ||| -4.53718 +0 ||| a b ||| Glue=1 SourceWordPenalty=-0.868589 WordPenalty=-0.868589 Cost=0.3 LatticeCost_0=2.5 ||| -4.53718 +0 ||| a' b ||| Glue=1 SourceWordPenalty=-0.868589 WordPenalty=-0.868589 Cost=0.3 LatticeCost_0=2.5 ||| -4.53718 +0 ||| a' b ||| Glue=1 SourceWordPenalty=-0.868589 WordPenalty=-0.868589 Cost=0.3 LatticeCost_0=2.5 ||| -4.53718 +0 ||| a' b ||| Glue=1 SourceWordPenalty=-0.868589 WordPenalty=-0.868589 Cost=0.3 LatticeCost_0=2.5 ||| -4.53718 +1 ||| d' ||| SourceWordPenalty=-0.434294 WordPenalty=-0.434294 Cost0=-0.1 LatticeCost_0=0.1 UsesDPrime=1 ||| 999.031 +1 ||| d' ||| SourceWordPenalty=-0.434294 WordPenalty=-0.434294 Cost0=-0.1 LatticeCost_0=0.1 UsesDPrime=1 ||| 999.031 +1 ||| b ||| SourceWordPenalty=-0.434294 WordPenalty=-0.434294 Cost=0.2 ||| -1.06859 +1 ||| b ||| SourceWordPenalty=-0.434294 WordPenalty=-0.434294 Cost=0.2 ||| -1.06859 +1 ||| a ||| SourceWordPenalty=-0.434294 WordPenalty=-0.434294 Cost=0.1 LatticeCost_0=0.5 ||| -1.46859 +1 ||| a' ||| SourceWordPenalty=-0.434294 WordPenalty=-0.434294 Cost=0.1 LatticeCost_0=0.5 ||| -1.46859 +1 ||| a ||| SourceWordPenalty=-0.434294 WordPenalty=-0.434294 Cost=0.1 LatticeCost_0=0.5 ||| -1.46859 +1 ||| a' ||| SourceWordPenalty=-0.434294 WordPenalty=-0.434294 Cost=0.1 LatticeCost_0=0.5 ||| -1.46859 diff --git a/tests/system_tests/lattice/input.txt b/tests/system_tests/lattice/input.txt index e0cd1b57..17bfd47c 100644 --- a/tests/system_tests/lattice/input.txt +++ b/tests/system_tests/lattice/input.txt @@ -1 +1,2 @@ ((('A',0.5,1),('C',0.25,1),('AB',0.125,2),),(('B',2,1),),) +((('A',0.5,1),('D\'',{'LatticeCost_0':0.1, 'UsesDPrime':1.0,},1),('B', 1)),) diff --git a/tests/system_tests/lattice/lattice.scfg b/tests/system_tests/lattice/lattice.scfg index 87a72383..04fe0cf0 100644 --- a/tests/system_tests/lattice/lattice.scfg +++ b/tests/system_tests/lattice/lattice.scfg @@ -4,3 +4,4 @@ [X] ||| AB ||| ab ||| Cost=0.1 [X] ||| C B ||| cb ||| Cost=0.3 [X] ||| A B ||| a_b ||| Cost=0.2 +[X] ||| D' ||| d' ||| Cost0=-0.1 diff --git a/tests/system_tests/lattice/weights b/tests/system_tests/lattice/weights index cb59b27b..7e7d0fa8 100644 --- a/tests/system_tests/lattice/weights +++ b/tests/system_tests/lattice/weights @@ -2,4 +2,5 @@ WordPenalty 1 SourceWordPenalty 1 Glue 0 Cost -1 -LatticeCost -1 +LatticeCost_0 -1 +UsesDPrime 1000 -- cgit v1.2.3