summaryrefslogtreecommitdiff
path: root/decoder/ff_soft_syntax.cc
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2013-11-05 18:15:18 +0100
committerPatrick Simianer <p@simianer.de>2013-11-05 18:15:18 +0100
commita7a0773b0e299f71409cf4a13d18ea7db5ab3fc1 (patch)
treea7c570f748480fd17c82e82163d1c2dbd5315a3f /decoder/ff_soft_syntax.cc
parent5a23ee2ae792b629e0f52b9c7fdf293de60a0ca1 (diff)
syntax features now read trees from files -- no more escaping!
Diffstat (limited to 'decoder/ff_soft_syntax.cc')
-rw-r--r--decoder/ff_soft_syntax.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/decoder/ff_soft_syntax.cc b/decoder/ff_soft_syntax.cc
index a3d26135..23fe87bd 100644
--- a/decoder/ff_soft_syntax.cc
+++ b/decoder/ff_soft_syntax.cc
@@ -107,10 +107,10 @@ struct SoftSyntaxFeaturesImpl {
switch(feat_type) {
case '2':
if (lhs_str.compare(label) == 0) {
- os << "SYN:" << label << "_conform";
+ os << "SOFT:" << label << "_conform";
}
else {
- os << "SYN:" << label << "_cross";
+ os << "SOFT:" << label << "_cross";
}
fid_ef = FD::Convert(os.str());
if (fid_ef > 0) {
@@ -119,7 +119,7 @@ struct SoftSyntaxFeaturesImpl {
}
break;
case '_':
- os << "SYN:" << label;
+ os << "SOFT:" << label;
fid_ef = FD::Convert(os.str());
if (lhs_str.compare(label) == 0) {
if (fid_ef > 0) {
@@ -136,7 +136,7 @@ struct SoftSyntaxFeaturesImpl {
break;
case '+':
if (lhs_str.compare(label) == 0) {
- os << "SYN:" << label << "_conform";
+ os << "SOFT:" << label << "_conform";
fid_ef = FD::Convert(os.str());
if (fid_ef > 0) {
//cerr << "Feature: " << os.str() << endl;
@@ -147,7 +147,7 @@ struct SoftSyntaxFeaturesImpl {
case '-':
//cerr << "-" << endl;
if (lhs_str.compare(label) != 0) {
- os << "SYN:" << label << "_cross";
+ os << "SOFT:" << label << "_cross";
fid_ef = FD::Convert(os.str());
if (fid_ef > 0) {
//cerr << "Feature :" << os.str() << endl;
@@ -194,6 +194,9 @@ void SoftSyntaxFeatures::TraversalFeaturesImpl(const SentenceMetadata& smeta,
}
void SoftSyntaxFeatures::PrepareForInput(const SentenceMetadata& smeta) {
- impl->InitializeGrids(smeta.GetSGMLValue("src_tree"), smeta.GetSourceLength());
+ ReadFile f = ReadFile(smeta.GetSGMLValue("src_tree"));
+ string tree;
+ f.ReadAll(tree);
+ impl->InitializeGrids(tree, smeta.GetSourceLength());
}