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:
authorHieu Hoang <hieuhoang@gmail.com>2016-10-06 15:31:18 +0300
committerHieu Hoang <hieuhoang@gmail.com>2016-10-06 15:31:18 +0300
commitd03991acec06b10bdd6fe213aac64012978ae90b (patch)
tree95ef860a74603cd5dbddc00c1323caad04dbb290
parentfa888166c00d266c09de6f22d123901aae15d73a (diff)
delete CreateProbingPT2
-rw-r--r--Jamroot2
-rw-r--r--contrib/moses2/CreateProbingPT2.cpp113
-rw-r--r--contrib/moses2/Jamfile3
3 files changed, 3 insertions, 115 deletions
diff --git a/Jamroot b/Jamroot
index efafa0122..7a7be5c93 100644
--- a/Jamroot
+++ b/Jamroot
@@ -341,3 +341,5 @@ if [ path.exists $(TOP)/dist ] && $(prefix) != dist {
local temp = [ _shell "mkdir -p $(TOP)/bin" ] ;
local temp = [ _shell "rm -f $(TOP)/bin/moses_chart" ] ;
local temp = [ _shell "cd $(TOP)/bin && ln -s moses moses_chart" ] ;
+local temp = [ _shell "cd $(TOP)/bin && ln -s CreateProbingPT CreateProbingPT2" ] ;
+
diff --git a/contrib/moses2/CreateProbingPT2.cpp b/contrib/moses2/CreateProbingPT2.cpp
deleted file mode 100644
index 24b0e2fd1..000000000
--- a/contrib/moses2/CreateProbingPT2.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-#include <string>
-#include <boost/program_options.hpp>
-#include "util/usage.hh"
-#include "TranslationModel/ProbingPT/storing.hh"
-#include "legacy/InputFileStream.h"
-#include "legacy/OutputFileStream.h"
-#include "legacy/Util2.h"
-
-using namespace std;
-
-std::string ReformatSCFGFile(const std::string &path);
-
-int main(int argc, char* argv[])
-{
- string inPath, outPath;
- int num_scores = 4;
- int num_lex_scores = 0;
- bool log_prob = false;
- bool scfg = false;
- int max_cache_size = 50000;
-
- namespace po = boost::program_options;
- po::options_description desc("Options");
- desc.add_options()
- ("help", "Print help messages")
- ("input-pt", po::value<string>()->required(), "Text pt")
- ("output-dir", po::value<string>()->required(), "Directory when binary files will be written")
- ("num-scores", po::value<int>()->default_value(num_scores), "Number of pt scores")
- ("num-lex-scores", po::value<int>()->default_value(num_lex_scores), "Number of lexicalized reordering scores")
- ("log-prob", "log (and floor) probabilities before storing")
- ("max-cache-size", po::value<int>()->default_value(max_cache_size), "Maximum number of high-count source lines to write to cache file. 0=no cache, negative=no limit")
- ("scfg", "Rules are SCFG in Moses format (ie. with non-terms and LHS")
-
- ;
-
- po::variables_map vm;
- try {
- po::store(po::parse_command_line(argc, argv, desc),
- vm); // can throw
-
- /** --help option
- */
- if ( vm.count("help")) {
- std::cout << desc << std::endl;
- return EXIT_SUCCESS;
- }
-
- po::notify(vm); // throws on error, so do after help in case
- // there are any problems
- } catch(po::error& e) {
- std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
- std::cerr << desc << std::endl;
- return EXIT_FAILURE;
- }
-
- if (vm.count("input-pt")) inPath = vm["input-pt"].as<string>();
- if (vm.count("output-dir")) outPath = vm["output-dir"].as<string>();
- if (vm.count("num-scores")) num_scores = vm["num-scores"].as<int>();
- if (vm.count("num-lex-scores")) num_lex_scores = vm["num-lex-scores"].as<int>();
- if (vm.count("max-cache-size")) max_cache_size = vm["max-cache-size"].as<int>();
- if (vm.count("log-prob")) log_prob = true;
- if (vm.count("scfg")) scfg = true;
-
-
- if (scfg) {
- inPath = ReformatSCFGFile(inPath);
- }
-
- Moses2::createProbingPT(inPath, outPath, num_scores, num_lex_scores, log_prob, max_cache_size, scfg);
-
- //util::PrintUsage(std::cout);
- return 0;
-}
-
-std::string ReformatSCFGFile(const std::string &path)
-{
- Moses2::InputFileStream inFile(path);
- string reformattedPath = path + ".reformat.gz";
- Moses2::OutputFileStream outFile(reformattedPath);
-
- string line;
- while (getline(inFile, line)) {
- vector<string> toks = Moses2::TokenizeMultiCharSeparator(line, "|||");
- assert(toks.size() >= 3);
-
- // source
- vector<string> sourceToks = Moses2::Tokenize(toks[0], " ");
- for (size_t i = 0; i < sourceToks.size() - 1; ++i) {
- outFile << sourceToks[i] << " ";
- }
-
- // other columns
- for (size_t i = 1; i < toks.size(); ++i) {
- outFile << "|||" << toks[i];
- }
- outFile << endl;
- }
-
- inFile.Close();
- outFile.Close();
-
- string sortedPath = path + ".reformat.sorted.gz";
- string tmpPath = path + ".tmp ";
- string cmd = "mkdir " + tmpPath
- + " && gzip -dc " + reformattedPath + " | LC_ALL=C sort -T " + tmpPath + " | gzip -c > " + sortedPath;
- system(cmd.c_str());
-
- cmd = "rm -rf " + tmpPath + " " + reformattedPath;
- system(cmd.c_str());
-
- return sortedPath;
-}
-
diff --git a/contrib/moses2/Jamfile b/contrib/moses2/Jamfile
index 193ac8db5..8791e3cf9 100644
--- a/contrib/moses2/Jamfile
+++ b/contrib/moses2/Jamfile
@@ -173,11 +173,10 @@ alias deps : ../..//z ../..//boost_iostreams ../..//boost_filesystem ../../mose
deps ;
exe moses2 : Main.cpp moses2_lib ;
-exe CreateProbingPT2 : CreateProbingPT2.cpp moses2_lib ;
if [ xmlrpc ] {
echo "Building Moses2" ;
- alias programs : moses2 CreateProbingPT2 ;
+ alias programs : moses2 ;
}
else {
echo "Not building Moses2" ;