summaryrefslogtreecommitdiff
path: root/extractor
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-08-19 21:53:34 +0100
committerPatrick Simianer <p@simianer.de>2014-08-19 21:53:34 +0100
commit6a47226ee857483d6e06753e36d0b34933d8d300 (patch)
treef274bf4b956b8d3c420d7b3fa8204eb35ea7db2b /extractor
parentb9be57140b1e9cab50ff8eb0c6cd90815ab6da0e (diff)
make extractor write gzipped files (by default)
Diffstat (limited to 'extractor')
-rw-r--r--extractor/Makefile.am2
-rw-r--r--extractor/run_extractor.cc7
2 files changed, 5 insertions, 4 deletions
diff --git a/extractor/Makefile.am b/extractor/Makefile.am
index a406d9dc..cdfbb307 100644
--- a/extractor/Makefile.am
+++ b/extractor/Makefile.am
@@ -115,7 +115,7 @@ noinst_LIBRARIES = libextractor.a
sacompile_SOURCES = sacompile.cc
sacompile_LDADD = libextractor.a
run_extractor_SOURCES = run_extractor.cc
-run_extractor_LDADD = libextractor.a
+run_extractor_LDADD = libextractor.a ../utils/libutils.a
extract_SOURCES = extract.cc
extract_LDADD = libextractor.a
diff --git a/extractor/run_extractor.cc b/extractor/run_extractor.cc
index 00564a36..75fae627 100644
--- a/extractor/run_extractor.cc
+++ b/extractor/run_extractor.cc
@@ -33,6 +33,7 @@
#include "time_util.h"
#include "translation_table.h"
#include "vocabulary.h"
+#include "../utils/filelib.h"
namespace fs = boost::filesystem;
namespace po = boost::program_options;
@@ -42,7 +43,7 @@ using namespace features;
// Returns the file path in which a given grammar should be written.
fs::path GetGrammarFilePath(const fs::path& grammar_path, int file_number) {
- string file_name = "grammar." + to_string(file_number);
+ string file_name = "grammar." + to_string(file_number) + ".gz";
return grammar_path / file_name;
}
@@ -239,8 +240,8 @@ int main(int argc, char** argv) {
}
Grammar grammar = extractor.GetGrammar(
sentences[i], blacklisted_sentence_ids);
- ofstream output(GetGrammarFilePath(grammar_path, i).c_str());
- output << grammar;
+ WriteFile output(GetGrammarFilePath(grammar_path, i).c_str());
+ *output << grammar;
}
for (size_t i = 0; i < sentences.size(); ++i) {