summaryrefslogtreecommitdiff
path: root/extractor/run_extractor.cc
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-02-14 23:17:15 +0000
committerPaul Baltescu <pauldb89@gmail.com>2013-02-14 23:17:15 +0000
commit63b30ed9c8510da8c8e2f6a456576424fddacc0e (patch)
tree1b5278fb5a4480b7f7a965bb6de8f6f9e9c4d333 /extractor/run_extractor.cc
parent0a53f7eca74c165b5ce1c238f1999ddf1febea55 (diff)
Working version of the grammar extractor.
Diffstat (limited to 'extractor/run_extractor.cc')
-rw-r--r--extractor/run_extractor.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/extractor/run_extractor.cc b/extractor/run_extractor.cc
index 37a9cba0..ed30e6fe 100644
--- a/extractor/run_extractor.cc
+++ b/extractor/run_extractor.cc
@@ -114,8 +114,8 @@ int main(int argc, char** argv) {
make_shared<TargetGivenSourceCoherent>(),
make_shared<SampleSourceCount>(),
make_shared<CountSourceTarget>(),
- make_shared<MaxLexTargetGivenSource>(table),
make_shared<MaxLexSourceGivenTarget>(table),
+ make_shared<MaxLexTargetGivenSource>(table),
make_shared<IsSourceSingleton>(),
make_shared<IsSourceTargetSingleton>()
};
@@ -138,6 +138,10 @@ int main(int argc, char** argv) {
int grammar_id = 0;
fs::path grammar_path = vm["grammars"].as<string>();
+ if (!fs::is_directory(grammar_path)) {
+ fs::create_directory(grammar_path);
+ }
+
string sentence, delimiter = "|||";
while (getline(cin, sentence)) {
string suffix = "";
@@ -148,7 +152,8 @@ int main(int argc, char** argv) {
}
Grammar grammar = extractor.GetGrammar(sentence);
- fs::path grammar_file = grammar_path / to_string(grammar_id);
+ string file_name = "grammar." + to_string(grammar_id);
+ fs::path grammar_file = grammar_path / file_name;
ofstream output(grammar_file.c_str());
output << grammar;