mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-02 17:09:36 +03:00
Merge branch 'master' of github.com:moses-smt/mosesdecoder
This commit is contained in:
commit
42f7d5bb28
@ -10,10 +10,10 @@ local with-cmph = [ option.get "with-cmph" ] ;
|
||||
if $(with-cmph) {
|
||||
exe processPhraseTableMin : processPhraseTableMin.cpp ../moses/src//moses ;
|
||||
exe processLexicalTableMin : processLexicalTableMin.cpp ../moses/src//moses ;
|
||||
# exe queryPhraseTableMin : queryPhraseTableMin.cpp ../moses/src//moses ;
|
||||
exe queryPhraseTableMin : queryPhraseTableMin.cpp ../moses/src//moses ;
|
||||
|
||||
# alias programsMin : processPhraseTableMin processLexicalTableMin queryPhraseTableMin ;
|
||||
alias programsMin : processPhraseTableMin processLexicalTableMin ;
|
||||
alias programsMin : processPhraseTableMin processLexicalTableMin queryPhraseTableMin ;
|
||||
# alias programsMin : processPhraseTableMin processLexicalTableMin ;
|
||||
}
|
||||
else {
|
||||
alias programsMin ;
|
||||
|
2
scripts/fuzzy-match/compile.sh
Executable file
2
scripts/fuzzy-match/compile.sh
Executable file
@ -0,0 +1,2 @@
|
||||
g++ -I ../../moses/src/ -I ../../ create_xml.cpp
|
||||
|
93
scripts/fuzzy-match/create_xml.cpp
Normal file
93
scripts/fuzzy-match/create_xml.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "Util.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace Moses;
|
||||
|
||||
void createXML();
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
assert(argc == 2);
|
||||
|
||||
string inPath(argv[1]);
|
||||
|
||||
ifstream inStrme(inPath.c_str());
|
||||
ofstream rule((inPath + ".extract").c_str());
|
||||
ofstream ruleInv((inPath + ".extract.inv").c_str());
|
||||
|
||||
int setenceId;
|
||||
float score;
|
||||
string source;
|
||||
string *input = NULL;
|
||||
vector<string> targets, alignments, paths;
|
||||
vector<int> counts;
|
||||
|
||||
string inLine;
|
||||
|
||||
int step = 0;
|
||||
while (!inStrme.eof())
|
||||
{
|
||||
getline(inStrme, inLine);
|
||||
cout << inLine << endl;
|
||||
switch (step)
|
||||
{
|
||||
case 0:
|
||||
setenceId = Scan<int>(inLine);
|
||||
++step;
|
||||
break;
|
||||
case 1:
|
||||
score = Scan<float>(inLine);
|
||||
++step;
|
||||
break;
|
||||
case 2:
|
||||
source = inLine;
|
||||
++step;
|
||||
break;
|
||||
case 3:
|
||||
if (input == NULL) {
|
||||
input = new string(inLine);
|
||||
}
|
||||
else {
|
||||
assert(inLine == *input);
|
||||
}
|
||||
++step;
|
||||
break;
|
||||
case 4:
|
||||
targets.push_back(inLine);
|
||||
++step;
|
||||
break;
|
||||
case 5:
|
||||
alignments.push_back(inLine);
|
||||
++step;
|
||||
break;
|
||||
case 6:
|
||||
paths.push_back(inLine);
|
||||
++step;
|
||||
break;
|
||||
case 7:
|
||||
counts.push_back(Scan<int>(inLine));
|
||||
++step;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
createXML();
|
||||
}
|
||||
|
||||
delete input;
|
||||
ruleInv.close();
|
||||
rule.close();
|
||||
inStrme.close();
|
||||
|
||||
}
|
||||
|
||||
void createXML()
|
||||
{
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user