mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-08-16 23:10:31 +03:00
add debug info
This commit is contained in:
parent
58400043b4
commit
0fc225c004
11
moses2/DLLEntryApi.cpp
Normal file → Executable file
11
moses2/DLLEntryApi.cpp
Normal file → Executable file
@ -1,5 +1,6 @@
|
||||
#include "Moses2Wrapper.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@ -23,7 +24,6 @@ using namespace std;
|
||||
using namespace Moses2;
|
||||
|
||||
extern "C" EXPORT MosesApiErrorCode __stdcall GetMosesSystem(const char* filePath, Moses2::Moses2Wrapper * *pObject) {
|
||||
|
||||
if (*pObject == NULL) {
|
||||
*pObject = new Moses2::Moses2Wrapper(filePath);
|
||||
return MS_API_OK;
|
||||
@ -34,10 +34,19 @@ extern "C" EXPORT MosesApiErrorCode __stdcall GetMosesSystem(const char* filePat
|
||||
}
|
||||
|
||||
extern "C" EXPORT MosesApiErrorCode __stdcall Translate(Moses2::Moses2Wrapper * pObject, long id, const char* input, char** output) {
|
||||
ofstream tmpfile;
|
||||
tmpfile.open("C:\\moses.log", ios::app);
|
||||
tmpfile << "Start Translate: " << endl;
|
||||
tmpfile << pObject << " " << endl;
|
||||
tmpfile << id << " " << endl;
|
||||
tmpfile << string(input) << endl;
|
||||
|
||||
if (pObject != NULL)
|
||||
{
|
||||
std::string tr = pObject->Translate(input, id);
|
||||
tmpfile << "tr=" << tr << endl;
|
||||
*output = Moses2Wrapper::CopyString(tr.c_str());
|
||||
tmpfile << "output=" << string(*output) << endl;
|
||||
return MS_API_OK;
|
||||
}
|
||||
else {
|
||||
|
Loading…
Reference in New Issue
Block a user