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

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Bertoldi <bertoldi@fbk.eu>2013-09-14 12:13:24 +0400
committerNicola Bertoldi <bertoldi@fbk.eu>2013-09-14 12:13:24 +0400
commit7dc6ad425561384c8e2d258da3a3486c0b4ba80b (patch)
treeac9a52a2bdbd9dbc16b8973661e30bfdcc686fff /moses/Util.cpp
parentf93a1db38152a6e714ba0be19974db8ab426573e (diff)
beautify
Diffstat (limited to 'moses/Util.cpp')
-rw-r--r--moses/Util.cpp82
1 files changed, 41 insertions, 41 deletions
diff --git a/moses/Util.cpp b/moses/Util.cpp
index 9e21d2406..f94c05f54 100644
--- a/moses/Util.cpp
+++ b/moses/Util.cpp
@@ -112,8 +112,8 @@ std::vector< std::map<std::string, std::string> > ProcessAndStripDLT(std::string
std::vector< std::map<std::string, std::string> > meta;
std::string lline = ToLower(line);
bool check_dlt = true;
-
- std::cerr << "GLOBAL START" << endl;
+
+ std::cerr << "GLOBAL START" << endl;
while (check_dlt) {
size_t start = lline.find("<dlt");
if (start == std::string::npos) {
@@ -133,50 +133,50 @@ std::vector< std::map<std::string, std::string> > ProcessAndStripDLT(std::string
line.erase(start,close-start+2);
lline.erase(start,close-start+2);
- if (dlt != ""){
-
- std::map<std::string, std::string> tmp_meta;
- for (size_t i = 1; i < dlt.size(); i++) {
- if (dlt[i] == '=') {
- std::string label = dlt.substr(0, i);
- std::string val = dlt.substr(i+1);
- std::cerr << "label:|" << label << "|" << endl;
- std::cerr << "val:|" << val << "|" << endl;
- if (val[0] == '"') {
- val = val.substr(1);
- // it admits any double quotation mark in the value of the attribute
- // it assumes that just one attribute is present in the tag,
- // it assumes that the value starts and ends with double quotation mark
- size_t close = val.rfind('"');
- if (close == std::string::npos) {
- TRACE_ERR("SGML parse error: missing \"\n");
- dlt = "";
- i = 0;
- } else {
- dlt = val.substr(close+1);
- val = val.substr(0, close);
- i = 0;
- }
- } else {
- size_t close = val.find(' ');
- if (close == std::string::npos) {
- dlt = "";
- i = 0;
+ if (dlt != "") {
+
+ std::map<std::string, std::string> tmp_meta;
+ for (size_t i = 1; i < dlt.size(); i++) {
+ if (dlt[i] == '=') {
+ std::string label = dlt.substr(0, i);
+ std::string val = dlt.substr(i+1);
+ std::cerr << "label:|" << label << "|" << endl;
+ std::cerr << "val:|" << val << "|" << endl;
+ if (val[0] == '"') {
+ val = val.substr(1);
+ // it admits any double quotation mark in the value of the attribute
+ // it assumes that just one attribute is present in the tag,
+ // it assumes that the value starts and ends with double quotation mark
+ size_t close = val.rfind('"');
+ if (close == std::string::npos) {
+ TRACE_ERR("SGML parse error: missing \"\n");
+ dlt = "";
+ i = 0;
+ } else {
+ dlt = val.substr(close+1);
+ val = val.substr(0, close);
+ i = 0;
+ }
} else {
- dlt = val.substr(close+1);
- val = val.substr(0, close);
+ size_t close = val.find(' ');
+ if (close == std::string::npos) {
+ dlt = "";
+ i = 0;
+ } else {
+ dlt = val.substr(close+1);
+ val = val.substr(0, close);
+ }
}
- }
- label = Trim(label);
- dlt = Trim(dlt);
+ label = Trim(label);
+ dlt = Trim(dlt);
- tmp_meta[label] = val;
- std::cerr << "tmp_meta:|" << tmp_meta[label] << "|" << endl;
+ tmp_meta[label] = val;
+ std::cerr << "tmp_meta:|" << tmp_meta[label] << "|" << endl;
+ }
}
- }
- meta.push_back(tmp_meta);
- }
+ meta.push_back(tmp_meta);
+ }
}
std::cerr << "GLOBAL END" << endl;
return meta;