Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230>2008-04-18 13:04:38 +0400
committerhieuhoang1972 <hieuhoang1972@1f5c12ca-751b-0410-a591-d2e778427230>2008-04-18 13:04:38 +0400
commita822d61d8fd04e5aca5b398175657384a3750955 (patch)
treeda75ae5be1918c157323726565cda01d5116eee3
parent24a5a24c8b03e3d25ec96cddbd81d28283757caf (diff)
prevent -inf in lex re-ordering. Code contributed by Christian Hardmeier
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@1596 1f5c12ca-751b-0410-a591-d2e778427230
-rw-r--r--moses/src/LexicalReorderingTable.cpp2
-rwxr-xr-xscripts/training/train-factored-phrase-model.perl16
2 files changed, 10 insertions, 8 deletions
diff --git a/moses/src/LexicalReorderingTable.cpp b/moses/src/LexicalReorderingTable.cpp
index ebebaec2f..27a84dc0f 100644
--- a/moses/src/LexicalReorderingTable.cpp
+++ b/moses/src/LexicalReorderingTable.cpp
@@ -189,6 +189,7 @@ void LexicalReorderingTableMemory::LoadFromFile(const std::string& filePath){
exit(0);
}
std::transform(p.begin(),p.end(),p.begin(),TransformScore);
+ std::transform(p.begin(),p.end(),p.begin(),FloorScore);
//save it all into our map
m_Table[MakeKey(f,e,c)] = p;
}
@@ -386,6 +387,7 @@ bool LexicalReorderingTableTree::Create(std::istream& inFile,
}
//transform score now...
std::transform(score.begin(),score.end(),score.begin(),TransformScore);
+ std::transform(score.begin(),score.end(),score.begin(),FloorScore);
std::vector<Score> scores;
scores.push_back(score);
diff --git a/scripts/training/train-factored-phrase-model.perl b/scripts/training/train-factored-phrase-model.perl
index ddd646802..4bab74237 100755
--- a/scripts/training/train-factored-phrase-model.perl
+++ b/scripts/training/train-factored-phrase-model.perl
@@ -1222,14 +1222,14 @@ sub store_reordering_f {
my $total_previous_f = $mono_previous_f+$swap_previous_f+$other_previous_f;
my $total_following_f = $mono_following_f+$swap_following_f+$other_following_f;
if(defined($REORDERING_MODEL{"msd-f"})) {
- printf OF ("%s ||| %.5f %.5f %.5f\n",
+ printf OF ("%s ||| %g %g %g\n",
$f_current,
$mono_previous_f/$total_previous_f,
$swap_previous_f/$total_previous_f,
$other_previous_f/$total_previous_f);
}
if(defined($REORDERING_MODEL{"msd-bidirectional-f"})) {
- printf OBF ("%s ||| %.5f %.5f %.5f %.5f %.5f %.5f\n",
+ printf OBF ("%s ||| %g %g %g %g %g %g\n",
$f_current,
$mono_previous_f/$total_previous_f,
$swap_previous_f/$total_previous_f,
@@ -1239,13 +1239,13 @@ sub store_reordering_f {
$other_following_f/$total_following_f);
}
if(defined($REORDERING_MODEL{"monotonicity-f"})) {
- printf MF ("%s ||| %.5f %.5f\n",
+ printf MF ("%s ||| %g %g\n",
$f_current,
$mono_previous_f/$total_previous_f,
($swap_previous_f+$other_previous_f)/$total_previous_f);
}
if(defined($REORDERING_MODEL{"monotonicity-bidirectional-f"})) {
- printf MBF ("%s ||| %.5f %.5f %.5f %.5f\n",
+ printf MBF ("%s ||| %g %g %g %g\n",
$f_current,
$mono_previous_f/$total_previous_f,
($swap_previous_f+$other_previous_f)/$total_previous_f,
@@ -1259,14 +1259,14 @@ sub store_reordering_fe {
my $total_following_fe = $mono_following_fe+$swap_following_fe+$other_following_fe;
if(defined($REORDERING_MODEL{"msd-fe"})) {
- printf OFE ("%s ||| %s ||| %.5f %.5f %.5f\n",
+ printf OFE ("%s ||| %s ||| %g %g %g\n",
$f_current, $e_current,
$mono_previous_fe/$total_previous_fe,
$swap_previous_fe/$total_previous_fe,
$other_previous_fe/$total_previous_fe);
}
if(defined($REORDERING_MODEL{"msd-bidirectional-fe"})) {
- printf OBFE ("%s ||| %s ||| %.5f %.5f %.5f %.5f %.5f %.5f\n",
+ printf OBFE ("%s ||| %s ||| %g %g %g %g %g %g\n",
$f_current, $e_current,
$mono_previous_fe/$total_previous_fe,
$swap_previous_fe/$total_previous_fe,
@@ -1276,13 +1276,13 @@ sub store_reordering_fe {
$other_following_fe/$total_following_fe);
}
if(defined($REORDERING_MODEL{"monotonicity-fe"})) {
- printf MFE ("%s ||| %s ||| %.5f %.5f\n",
+ printf MFE ("%s ||| %s ||| %g %g\n",
$f_current, $e_current,
$mono_previous_fe/$total_previous_fe,
($swap_previous_fe+$other_previous_fe)/$total_previous_fe);
}
if(defined($REORDERING_MODEL{"monotonicity-bidirectional-fe"})) {
- printf MBFE ("%s ||| %s ||| %.5f %.5f %.5f %.5f\n",
+ printf MBFE ("%s ||| %s ||| %g %g %g %g\n",
$f_current, $e_current,
$mono_previous_fe/$total_previous_fe,
($swap_previous_fe+$other_previous_fe)/$total_previous_fe,