changes to handle part input

This commit is contained in:
Anoop Kunchukuttan 2020-10-01 08:38:30 +05:30
parent d325b0d274
commit d97c54b729
3 changed files with 54 additions and 38 deletions

View File

@ -1,33 +1,33 @@
{
"Registrations":[
{
"component": {
"type": "git",
"git": {
"repositoryUrl": "https://github.com/moses-smt/mosesdecoder",
"commitHash": "78ca5f3cc5aa671a8a5d36c56452e217e6f00828"
}
}
},
{
"component": {
"type": "git",
"git": {
"repositoryUrl": "https://git.code.sf.net/p/cmph/git",
"commitHash": "a250982ade093f4eed0552bbdd22dd7b0432007f"
}
}
},
{
"Component": {
"Type": "other",
"Other": {
"Name": "xml-rpc-c",
"Version": "1.51.06",
"DownloadUrl": "https://sourceforge.net/projects/xmlrpc-c/files/Xmlrpc-c%20Super%20Stable/1.51.06/xmlrpc-c-1.51.06.tgz"
}
}
},
]
}
{
"Registrations":[
{
"component": {
"type": "git",
"git": {
"repositoryUrl": "https://github.com/moses-smt/mosesdecoder",
"commitHash": "78ca5f3cc5aa671a8a5d36c56452e217e6f00828"
}
}
},
{
"component": {
"type": "git",
"git": {
"repositoryUrl": "https://git.code.sf.net/p/cmph/git",
"commitHash": "a250982ade093f4eed0552bbdd22dd7b0432007f"
}
}
},
{
"Component": {
"Type": "other",
"Other": {
"Name": "xml-rpc-c",
"Version": "1.51.06",
"DownloadUrl": "https://sourceforge.net/projects/xmlrpc-c/files/Xmlrpc-c%20Super%20Stable/1.51.06/xmlrpc-c-1.51.06.tgz"
}
}
},
]
}

View File

@ -59,6 +59,7 @@ void Manager::Init()
InitPools();
FactorCollection &vocab = system.GetVocab();
//TODO: need option to choose Sentence vs SentenceWithCandidates
m_input = Moses2::SentenceWithCandidates::CreateFromString(GetPool(), vocab, system, m_inputStr);
m_bitmaps = new Bitmaps(GetPool());

View File

@ -12,7 +12,7 @@
#include "../System.h"
#include "../parameters/AllOptions.h"
#include "../legacy/Util2.h"
#include <unordered_map>
using namespace std;
@ -23,15 +23,30 @@ SentenceWithCandidates *SentenceWithCandidates::CreateFromString(MemPool &pool,
const System &system, const std::string &str)
{
SentenceWithCandidates *ret;
// unordered_map<string,unordered_map<string, float>> ;
vector<string> result;
boost::split(result, str, boost::is_any_of("|||"));
// unordered_map<string, float> s;
// s["abc"]=0.2;
// s["awc"]=0.4;
// s["abe"]=0.3;
// translation_candidates["src_1"]=s;
if (result.size()!=2){
// s.clear();
// s["pqr"]=0.2;
// s["yen"]=0.4;
// s["dkg"]=0.5;
// translation_candidates["src_2"]=s;
vector<string> input_parts;
boost::split(input_parts, str, boost::is_any_of("|||"));
if (input_parts.size()!=2){
exit(1);
}
const string partstr = result[0]
const string partstr = input_parts[0]
parseCandidates(input_parts[1])
if (system.options.input.xml_policy) {
// xml