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
path: root/misc
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2013-05-16 18:38:05 +0400
committerHieu Hoang <hieuhoang@gmail.com>2013-05-16 18:38:05 +0400
commit8dd84d7a408f6b07eb4ff60818361a3c4038d64b (patch)
tree97d5bdf020dac216b2383fadccdddfae4901988f /misc
parent3876c47d1dce0c874a368ebcf98a90e10fa2dba2 (diff)
change integration of sparse features with EMS to account for new weights format
Diffstat (limited to 'misc')
-rw-r--r--misc/create-ini/Main.cpp41
-rw-r--r--misc/create-ini/Main.h0
2 files changed, 41 insertions, 0 deletions
diff --git a/misc/create-ini/Main.cpp b/misc/create-ini/Main.cpp
index 4eee119dc..d4ff873f7 100644
--- a/misc/create-ini/Main.cpp
+++ b/misc/create-ini/Main.cpp
@@ -17,10 +17,13 @@ using namespace std;
string iniPath;
vector<FF*> ffVec;
+vector<string> additionalIni;
bool isHierarchical = false;
int inputFactorMax = 0;
void OutputIni();
+void OutputAdditionalIni(ofstream &out);
+void OutputAdditionalIni(ofstream &out, const string &path);
void ParseFactors(const string &line, vector< pair<Factors, Factors> > &ret);
int main(int argc, char **argv)
@@ -81,6 +84,21 @@ int main(int argc, char **argv)
++i;
inputFactorMax = Scan<int>(argv[i]);
}
+ else if (key == "-additional-ini-file") {
+ ++i;
+ additionalIni.push_back(argv[i]);
+ }
+ else if (key == "-sparse-translation-table") {
+ // ignore. TODO check that all pt can handle sparse features
+ }
+ else if (key == "-score-options") {
+ // ignore. TODO
+ ++i;
+ }
+ else if (key == "-additional-ini") {
+ // ignore. TODO
+ ++i;
+ }
else {
cerr << "Unknown arg " << key << endl;
@@ -177,9 +195,32 @@ void OutputIni()
}
strme << weightStrme.str();
+ strme << endl;
+
+ OutputAdditionalIni(strme);
strme << endl << endl << endl;
strme.close();
}
+void OutputAdditionalIni(ofstream &out)
+{
+ for (size_t i = 0; i < additionalIni.size(); ++i) {
+ string &path = additionalIni[i];
+ OutputAdditionalIni(out, path);
+ }
+}
+
+void OutputAdditionalIni(ofstream &out, const string &path)
+{
+ ifstream in(path.c_str());
+
+ string line;
+ while (getline(in, line)) {
+ out << line << endl;
+ }
+ in.close();
+}
+
+
diff --git a/misc/create-ini/Main.h b/misc/create-ini/Main.h
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/misc/create-ini/Main.h