Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Huck <mhuck@inf.ed.ac.uk>2015-12-10 17:02:51 +0300
committerMatthias Huck <mhuck@inf.ed.ac.uk>2015-12-10 17:02:51 +0300
commita95060579512ef7c27bad7aac28897d54a5e3de9 (patch)
treed5946bad33da85ef984d6cc6c14fb102a5c0a54a /phrase-extract
parenta11ee977229ffc215cd09e130d2ba8045a89efa1 (diff)
Hiero phrase orientation: write phrase property to glue grammar
Diffstat (limited to 'phrase-extract')
-rw-r--r--phrase-extract/extract-rules-main.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/phrase-extract/extract-rules-main.cpp b/phrase-extract/extract-rules-main.cpp
index 6f2d742f4..3dc3210c0 100644
--- a/phrase-extract/extract-rules-main.cpp
+++ b/phrase-extract/extract-rules-main.cpp
@@ -1154,10 +1154,14 @@ void writeGlueGrammar( const string & fileName, RuleExtractionOptions &options,
{
ofstream grammarFile;
grammarFile.open(fileName.c_str());
+ std::string glueRulesPhraseProperty = "";
+ if (options.phraseOrientation) {
+ glueRulesPhraseProperty.append(" ||| ||| {{Orientation 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25}}");
+ }
if (!options.targetSyntax) {
- grammarFile << "<s> [X] ||| <s> [S] ||| 1 ||| 0-0 ||| 0" << endl
- << "[X][S] </s> [X] ||| [X][S] </s> [S] ||| 1 ||| 0-0 1-1 ||| 0" << endl
- << "[X][S] [X][X] [X] ||| [X][S] [X][X] [S] ||| 2.718 ||| 0-0 1-1 ||| 0" << endl;
+ grammarFile << "<s> [X] ||| <s> [S] ||| 1 ||| 0-0 ||| 0" << glueRulesPhraseProperty << endl
+ << "[X][S] </s> [X] ||| [X][S] </s> [S] ||| 1 ||| 0-0 1-1 ||| 0" << glueRulesPhraseProperty << endl
+ << "[X][S] [X][X] [X] ||| [X][S] [X][X] [S] ||| 2.718 ||| 0-0 1-1 ||| 0" << glueRulesPhraseProperty << endl;
} else {
// chose a top label that is not already a label
string topLabel = "QQQQQQ";