decoder -show-weight to output consistent new format

This commit is contained in:
Hieu Hoang 2012-12-17 17:17:44 +00:00
parent 05045d574c
commit 667b8a495f
6 changed files with 27 additions and 23 deletions

View File

@ -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)"/>

View File

@ -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)"/>

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;