summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extools/featurize_grammar.cc17
-rw-r--r--gi/pipeline/backoff-pipe.pl2
-rwxr-xr-xgi/pipeline/evaluation-pipeline.pl2
-rwxr-xr-xgi/pipeline/local-gi-pipeline.pl2
4 files changed, 3 insertions, 20 deletions
diff --git a/extools/featurize_grammar.cc b/extools/featurize_grammar.cc
index 5c51fffe..2fc53ff9 100644
--- a/extools/featurize_grammar.cc
+++ b/extools/featurize_grammar.cc
@@ -306,22 +306,6 @@ struct RulePenalty : public FeatureExtractor {
const int fid_;
};
-struct BackoffRule : public FeatureExtractor {
- BackoffRule() : fid_(FD::Convert("BackoffRule")) {}
-
- virtual void ExtractFeatures(const WordID lhs,
- const vector<WordID>& src,
- const vector<WordID>& trg,
- const RuleStatistics& /*info*/,
- SparseVector<float>* result) const {
- (void) lhs; (void) src; (void) trg;
- const string& lhstr = TD::Convert(lhs);
- if(lhstr.find('_')!=string::npos)
- result->set_value(fid_, -1);
- }
- const int fid_;
-};
-
// The negative log of the condition rule probs
// ignoring the identities of the non-terminals.
// i.e. the prob Hiero would assign.
@@ -702,7 +686,6 @@ int main(int argc, char** argv){
reg.Register("LexProb", new FEFactory<LexProbExtractor>);
reg.Register("XFeatures", new FEFactory<XFeatures>);
reg.Register("LabelledRuleConditionals", new FEFactory<LabelledRuleConditionals>);
- reg.Register("BackoffRule", new FEFactory<BackoffRule>);
reg.Register("RulePenalty", new FEFactory<RulePenalty>);
reg.Register("LHSProb", new FEFactory<LHSProb>);
reg.Register("LabellingShape", new FEFactory<LabellingShape>);
diff --git a/gi/pipeline/backoff-pipe.pl b/gi/pipeline/backoff-pipe.pl
index 5e36b3d7..ac103c8b 100644
--- a/gi/pipeline/backoff-pipe.pl
+++ b/gi/pipeline/backoff-pipe.pl
@@ -180,7 +180,7 @@ sub create_backoff_rules {
for(my $i = 0; $i < scalar @finefreq; $i+=2) {
my $finecat = $finefreq[$i];
my $finefreq = $finefreq[$i+1];
- print TMP "[X$grmr1$coarse] ||| [X$grmr2$finecat,1]\t[1] ||| BackoffRule=$finefreq\n";
+ print TMP "[X$grmr1$coarse] ||| [X$grmr2$finecat,1]\t[1] ||| BackoffRule=$finefreq A=0-0\n";
}
}
close TMP;
diff --git a/gi/pipeline/evaluation-pipeline.pl b/gi/pipeline/evaluation-pipeline.pl
index fe0fb1a5..16b9a571 100755
--- a/gi/pipeline/evaluation-pipeline.pl
+++ b/gi/pipeline/evaluation-pipeline.pl
@@ -143,7 +143,7 @@ for my $feat (@features) {
if (!defined $rs) { die "DON'T KNOW ABOUT FEATURE $feat\n"; }
my @xfs = @$rs;
@xfeats = (@xfeats, @xfs);
- $FEATURIZER_OPTS .= " -f $feat";
+ $FEATURIZER_OPTS .= " -f $feat" unless $feat=="BackoffRule";
}
print STDERR "X-FEATS: @xfeats\n";
diff --git a/gi/pipeline/local-gi-pipeline.pl b/gi/pipeline/local-gi-pipeline.pl
index 9cffc492..8353a242 100755
--- a/gi/pipeline/local-gi-pipeline.pl
+++ b/gi/pipeline/local-gi-pipeline.pl
@@ -144,7 +144,7 @@ if (lc($MODEL) eq "pyp") {
} else {
topic_train();
}
-} elsif (lc($MODEL) =~ /pr|em|agree/)
+} elsif (lc($MODEL) =~ /pr|em|agree/) {
prem_train();
} else { die "Unsupported model type: $MODEL. Must be one of PYP or PREM.\n"; }
if($HIER_CAT) {