From a9171fa0aa0ad6d7611fe079ecee464bc5f78231 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Sun, 3 Nov 2013 21:56:06 +0100
Subject: cleaned up parsematch features
---
decoder/ff_parse_match.cc | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
(limited to 'decoder/ff_parse_match.cc')
diff --git a/decoder/ff_parse_match.cc b/decoder/ff_parse_match.cc
index ed556b91..94634b27 100644
--- a/decoder/ff_parse_match.cc
+++ b/decoder/ff_parse_match.cc
@@ -13,6 +13,10 @@ using namespace std;
// implements the parse match features as described in Vilar et al. (2008)
// source trees must be represented in Penn Treebank format, e.g.
// (S (NP John) (VP (V left)))
+//
+// Annotate source sentences with ..."
+// Note: You need to escape quite a lot of stuff in all your models!
+//
struct ParseMatchFeaturesImpl {
ParseMatchFeaturesImpl(const string& param) {
@@ -42,10 +46,8 @@ struct ParseMatchFeaturesImpl {
void InitializeGrids(const string& tree, unsigned src_len) {
assert(tree.size() > 0);
- //fids_cat.clear();
fids_ef.clear();
src_tree.clear();
- //fids_cat.resize(src_len, src_len + 1);
fids_ef.resize(src_len, src_len + 1);
src_tree.resize(src_len, src_len + 1, TD::Convert("XX"));
ParseTreeString(tree, src_len);
@@ -112,7 +114,7 @@ struct ParseMatchFeaturesImpl {
int fid_ef = FD::Convert("PM");
int min_dist; // minimal distance to next syntactic constituent of this rule's LHS
int summed_min_dists; // minimal distances of LHS and NTs summed up
- if (TD::Convert(lhs).compare("XX") != 0)
+ if (TD::Convert(lhs).compare("XX") != 0)
min_dist= 0;
// compute the distance to the next syntactical constituent
else {
@@ -131,7 +133,7 @@ struct ParseMatchFeaturesImpl {
ok = 1;
break;
}
- // check if removing k words from the rule span will
+ // check if removing k words from the rule span will
// lead to a syntactical constituent
else {
//cerr << "Hilfe...!" << endl;
@@ -144,7 +146,7 @@ struct ParseMatchFeaturesImpl {
ok = 1;
break;
}
- }
+ }
}
if (ok) break;
}
@@ -183,9 +185,9 @@ struct ParseMatchFeaturesImpl {
return min_dist;
}
- Array2D src_tree; // src_tree(i,j) NT = type
+ Array2D src_tree; // src_tree(i,j) NT = type
unsigned int src_sent_len;
- mutable Array2D