00001 /********************************* 00002 tercpp: an open-source Translation Edit Rate (TER) scorer tool for Machine Translation. 00003 00004 Copyright 2010-2013, Christophe Servan, LIUM, University of Le Mans, France 00005 Contact: christophe.servan@lium.univ-lemans.fr 00006 00007 The tercpp tool and library are free software: you can redistribute it and/or modify it 00008 under the terms of the GNU Lesser General Public License as published by 00009 the Free Software Foundation, either version 2.1 of the licence, or 00010 (at your option) any later version. 00011 00012 This program and library are distributed in the hope that it will be useful, but WITHOUT 00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 00015 for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with this library; if not, write to the Free Software Foundation, 00019 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 **********************************/ 00021 #include "alignmentStruct.h" 00022 00023 using namespace std; 00024 namespace TERCPPNS_TERCpp 00025 { 00026 string alignmentStruct::toString() 00027 { 00028 stringstream s; 00029 // s << "nword : " << vectorToString(nwords)<<endl; 00030 // s << "alignment" << vectorToString(alignment)<<endl; 00031 // s << "afterShift" << vectorToString(alignment)<<endl; 00032 s << "Nothing to be printed" <<endl; 00033 return s.str(); 00034 } 00035 void alignmentStruct::set(alignmentStruct l_alignmentStruct) 00036 { 00037 nwords=l_alignmentStruct.nwords; // The words we shifted 00038 alignment=l_alignmentStruct.alignment ; // for pra_more output 00039 aftershift=l_alignmentStruct.aftershift; // for pra_more output 00040 cost=l_alignmentStruct.cost; 00041 } 00042 00043 00044 00045 // alignmentStruct::alignmentStruct() 00046 // { 00047 // // vector<string> ref; 00048 // // vector<string> hyp; 00049 // // vector<string> aftershift; 00050 // 00051 // // alignmentStruct[] allshifts = null; 00052 // 00053 // numEdits=0; 00054 // numWords=0; 00055 // bestRef=""; 00056 // 00057 // numIns=0; 00058 // numDel=0; 00059 // numSub=0; 00060 // numSft=0; 00061 // numWsf=0; 00062 // } 00063 // alignmentStruct::alignmentStruct () 00064 // { 00065 // start = 0; 00066 // end = 0; 00067 // moveto = 0; 00068 // newloc = 0; 00069 // cost=1.0; 00070 // } 00071 // alignmentStruct::alignmentStruct (int _start, int _end, int _moveto, int _newloc) 00072 // { 00073 // start = _start; 00074 // end = _end; 00075 // moveto = _moveto; 00076 // newloc = _newloc; 00077 // cost=1.0; 00078 // } 00079 00080 // alignmentStruct::alignmentStruct (int _start, int _end, int _moveto, int _newloc, vector<string> _shifted) 00081 // { 00082 // start = _start; 00083 // end = _end; 00084 // moveto = _moveto; 00085 // newloc = _newloc; 00086 // shifted = _shifted; 00087 // cost=1.0; 00088 // } 00089 // string alignmentStruct::vectorToString(vector<string> vec) 00090 // { 00091 // string retour(""); 00092 // for (vector<string>::iterator vecIter=vec.begin();vecIter!=vec.end(); vecIter++) 00093 // { 00094 // retour+=(*vecIter)+"\t"; 00095 // } 00096 // return retour; 00097 // } 00098 00099 // string alignmentStruct::toString() 00100 // { 00101 // stringstream s; 00102 // s.str(""); 00103 // s << "[" << start << ", " << end << ", " << moveto << "/" << newloc << "]"; 00104 // if ((int)shifted.size() > 0) 00105 // { 00106 // s << " (" << vectorToString(shifted) << ")"; 00107 // } 00108 // return s.str(); 00109 // } 00110 00111 /* The distance of the shift. */ 00112 // int alignmentStruct::distance() 00113 // { 00114 // if (moveto < start) 00115 // { 00116 // return start - moveto; 00117 // } 00118 // else if (moveto > end) 00119 // { 00120 // return moveto - end; 00121 // } 00122 // else 00123 // { 00124 // return moveto - start; 00125 // } 00126 // } 00127 // 00128 // bool alignmentStruct::leftShift() 00129 // { 00130 // return (moveto < start); 00131 // } 00132 // 00133 // int alignmentStruct::size() 00134 // { 00135 // return (end - start) + 1; 00136 // } 00137 // alignmentStruct alignmentStruct::operator=(alignmentStruct t) 00138 // { 00139 // 00140 // return t; 00141 // } 00142 00143 00144 }