mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
decoder -show-weight to output consistent new format
This commit is contained in:
parent
05045d574c
commit
667b8a495f
@ -75,7 +75,6 @@
|
||||
<listOptionValue builtIn="false" value="boost_system-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_thread-mt"/>
|
||||
<listOptionValue builtIn="false" value="boost_filesystem-mt"/>
|
||||
<listOptionValue builtIn="false" value="rt"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.128214028" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
|
@ -73,7 +73,6 @@
|
||||
<listOptionValue builtIn="false" value="boost_thread-mt"/>
|
||||
<listOptionValue builtIn="false" value="lm"/>
|
||||
<listOptionValue builtIn="false" value="util"/>
|
||||
<listOptionValue builtIn="false" value="rt"/>
|
||||
</option>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.983725033" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
|
@ -191,17 +191,17 @@ static void PrintFeatureWeight(const FeatureFunction* ff)
|
||||
size_t numScoreComps = ff->GetNumScoreComponents();
|
||||
if (numScoreComps != ScoreProducer::unlimited) {
|
||||
vector<float> values = StaticData::Instance().GetAllWeights().GetScoresForProducer(ff);
|
||||
for (size_t i = 0; i < numScoreComps; ++i)
|
||||
cout << ff->GetScoreProducerDescription() << " "
|
||||
<< values[i] << endl;
|
||||
cout << ff->GetScoreProducerDescription() << "=";
|
||||
for (size_t i = 0; i < numScoreComps; ++i) {
|
||||
cout << " " << values[i];
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
else {
|
||||
if (ff->GetSparseProducerWeight() == 1)
|
||||
cout << ff->GetScoreProducerDescription() << " "
|
||||
<< " sparse" << endl;
|
||||
cout << ff->GetScoreProducerDescription() << "= sparse" << endl;
|
||||
else
|
||||
cout << ff->GetScoreProducerDescription() << " "
|
||||
<< ff->GetSparseProducerWeight() << endl;
|
||||
cout << ff->GetScoreProducerDescription() << "= " << ff->GetSparseProducerWeight() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,15 +317,17 @@ static void PrintFeatureWeight(const FeatureFunction* ff)
|
||||
size_t numScoreComps = ff->GetNumScoreComponents();
|
||||
if (numScoreComps != ScoreProducer::unlimited) {
|
||||
vector<float> values = StaticData::Instance().GetAllWeights().GetScoresForProducer(ff);
|
||||
for (size_t i = 0; i < numScoreComps; ++i)
|
||||
cout << ff->GetScoreProducerDescription() << " "
|
||||
<< values[i] << endl;
|
||||
cout << ff->GetScoreProducerDescription() << "=";
|
||||
for (size_t i = 0; i < numScoreComps; ++i) {
|
||||
cout << " " << values[i];
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
else {
|
||||
if (ff->GetSparseProducerWeight() == 1)
|
||||
cout << ff->GetScoreProducerDescription() << " sparse" << endl;
|
||||
cout << ff->GetScoreProducerDescription() << "= sparse" << endl;
|
||||
else
|
||||
cout << ff->GetScoreProducerDescription() << " " << ff->GetSparseProducerWeight() << endl;
|
||||
cout << ff->GetScoreProducerDescription() << "= " << ff->GetSparseProducerWeight() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,8 @@ while(<WEIGHT>) {
|
||||
$weights_file_spec = "\n".$_;
|
||||
$weights_file_flag = 1;
|
||||
}
|
||||
elsif (/^\[weight\-(\S+)\]/) {
|
||||
$current_weight = $1;
|
||||
elsif (/^\[weight]/) {
|
||||
$current_weight = $1;
|
||||
}
|
||||
elsif ($current_weight && /^(([\-\d\.]+)([Ee][+-]?[\d]+)?)$/) {
|
||||
push @{$WEIGHT{$current_weight}},$1;
|
||||
|
@ -1157,13 +1157,17 @@ sub get_featlist_from_file {
|
||||
while (<$fh>) {
|
||||
$nr++;
|
||||
chomp;
|
||||
/^(.+) (\S+)$/ || die "invalid feature: $_";
|
||||
my ($longname, $value) = ($1, $2);
|
||||
next if $value eq "sparse";
|
||||
push @errs, "$featlistfn:$nr:Bad initial value of $longname: $value\n"
|
||||
if $value !~ /^[+-]?[0-9.\-e]+$/;
|
||||
push @names, $longname;
|
||||
push @startvalues, $value;
|
||||
/^(\S+)= (.+)$/ || die "invalid feature: $_";
|
||||
my ($longname, $valuesStr) = ($1, $2);
|
||||
next if $valuesStr eq "sparse";
|
||||
|
||||
my @values = split(/ /, $valuesStr);
|
||||
foreach my $value (@values) {
|
||||
push @errs, "$featlistfn:$nr:Bad initial value of $longname: $value\n"
|
||||
if $value !~ /^[+-]?[0-9.\-e]+$/;
|
||||
push @names, $longname;
|
||||
push @startvalues, $value;
|
||||
}
|
||||
}
|
||||
close $fh;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user