Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Moses2Wrapper.h « moses2 - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c758ef2f326c520ce92a3b839774338ebb0817ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
#include <string>
#include <string.h>
namespace Moses2 {
	class Parameter;
	class System;
	extern "C" {
		enum MosesApiErrorCode {
			MS_API_OK,
			MS_API_E_FAILURE,
			MS_API_E_INPUT,
			MS_API_E_TIMEOUT
		};
	}
	class Moses2Wrapper
	{
		Parameter* m_param;
		System* m_system;

	public:
		Moses2Wrapper(const std::string& filePath);
		~Moses2Wrapper();
		std::string Translate(const std::string& input, long id);
		void UpdateLMPath(const std::string& filePath);
		int getEngineVersion();

		static char* CopyString(const char* str) {
			int32_t size = (int32_t)strlen(str);
			char* obj = (char*)malloc(size + 1);
			memcpy(obj, str, size);
			obj[size] = '\0';
			return obj;
		}
		static void Free(void* ptr) {
			free(ptr);
		}
	};

}