This commit is contained in:
rjawor 2019-07-23 22:29:32 +02:00
parent 2690b15958
commit f3c9f68da8
5 changed files with 8 additions and 7 deletions

View File

@ -29,8 +29,8 @@ LemmatizerResult LemmatizerFacade::lemmatizeSentence(std::string languageCode, s
}
LemmatizerResult LemmatizerFacade::lemmatizeSentences(std::string languageCode, std::vector<std::string> sentences) {
std::vector<std::string> result;
std::vector<LemmatizerResult> LemmatizerFacade::lemmatizeSentences(std::string languageCode, std::vector<std::string> sentences) {
std::vector<LemmatizerResult> result;
BOOST_FOREACH(std::string & sentence, sentences) {
result.push_back(lemmatizeSentence(languageCode, sentence));
}

View File

@ -1,5 +1,5 @@
#ifndef LEMMATIZER_RESULT_HDR
#define LEMMATIZER_RESULT__HDR
#define LEMMATIZER_RESULT_HDR
#include <string>

View File

@ -4,7 +4,7 @@ Tm::Tm(const int id,
const std::string & name,
const std::string & sourceLanguageCode,
const std::string & targetLanguageCode,
const in pairedTmId) :
const int pairedTmId) :
_id(id),_name(name),
_sourceLanguageCode(sourceLanguageCode),
_targetLanguageCode(targetLanguageCode),

View File

@ -36,14 +36,15 @@ std::vector<Tm> TmDAO::getTms() {
std::vector<Tm> result;
DBconnection connection;
connection.startTransaction();
std::string query = "select tm.id, tm.name, src_lang.code as src_code, trg_lang.code as trg_code from tm inner join language as src_lang on src_lang.id = tm.source_lang_id inner join language as trg_lang on trg_lang.id = tm.target_lang_id;";
std::string query = "select tm.id, tm.name, src_lang.code as src_code, trg_lang.code as trg_code, paired_tm_id from tm inner join language as src_lang on src_lang.id = tm.source_lang_id inner join language as trg_lang on trg_lang.id = tm.target_lang_id;";
PGresult * dbResult = connection.execute(query);
for (int i=0;i<connection.getRowCount(dbResult);i++) {
int id = connection.getIntValue(dbResult, i, 0);
std::string name = connection.getStringValue(dbResult, i, 1);
std::string sourceLanguageCode = connection.getStringValue(dbResult, i, 2);
std::string targetLanguageCode = connection.getStringValue(dbResult, i, 3);
result.push_back(Tm(id, name, sourceLanguageCode, targetLanguageCode));
int pairedTmId = connection.getIntValue(dbResult, i, 4);
result.push_back(Tm(id, name, sourceLanguageCode, targetLanguageCode, pairedTmId));
}
connection.clearResult(dbResult);
connection.endTransaction();

View File

@ -28,7 +28,7 @@ public:
std::vector<Tm> getTms();
std::pair<bool, std::string> getTm(int tmId);
Tm getTm(int tmId);
private: