diff options
author | Anoop Kunchukuttan <anoop.kunchukuttan@gmail.com> | 2020-10-01 06:08:30 +0300 |
---|---|---|
committer | Anoop Kunchukuttan <anoop.kunchukuttan@gmail.com> | 2020-10-01 06:08:30 +0300 |
commit | d97c54b7290b7aced558f3aae569e6c6dce7ce1f (patch) | |
tree | be57cbfc9785173fbc0e67bf0132c41f65ed3ba5 | |
parent | d325b0d274c4e29ed632759f67c7a51642b0d6c1 (diff) |
changes to handle part input
-rw-r--r-- | cgmanifest.json | 66 | ||||
-rw-r--r-- | moses2/PhraseBased/Manager.cpp | 1 | ||||
-rw-r--r-- | moses2/PhraseBased/SentenceWithCandidates.cpp | 25 |
3 files changed, 54 insertions, 38 deletions
diff --git a/cgmanifest.json b/cgmanifest.json index 6e7a9eafb..36cc60cff 100644 --- a/cgmanifest.json +++ b/cgmanifest.json @@ -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"
+ }
+ }
+ },
+ ]
+}
+
diff --git a/moses2/PhraseBased/Manager.cpp b/moses2/PhraseBased/Manager.cpp index 670c33894..37c2ec669 100644 --- a/moses2/PhraseBased/Manager.cpp +++ b/moses2/PhraseBased/Manager.cpp @@ -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()); diff --git a/moses2/PhraseBased/SentenceWithCandidates.cpp b/moses2/PhraseBased/SentenceWithCandidates.cpp index 4f55c5578..484d94cda 100644 --- a/moses2/PhraseBased/SentenceWithCandidates.cpp +++ b/moses2/PhraseBased/SentenceWithCandidates.cpp @@ -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>> ; + + // unordered_map<string, float> s; + // s["abc"]=0.2; + // s["awc"]=0.4; + // s["abe"]=0.3; + // translation_candidates["src_1"]=s; + + // s.clear(); + // s["pqr"]=0.2; + // s["yen"]=0.4; + // s["dkg"]=0.5; + // translation_candidates["src_2"]=s; - vector<string> result; - boost::split(result, str, boost::is_any_of("|||")); + vector<string> input_parts; + boost::split(input_parts, str, boost::is_any_of("|||")); - if (result.size()!=2){ + 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 |