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 #ifndef __BESTSHIFTSTRUCT_H__ 00022 #define __BESTSHIFTSTRUCT_H__ 00023 00024 00025 #include <vector> 00026 #include <cstdio> 00027 #include <string> 00028 #include <sstream> 00029 #include "tools.h" 00030 #include "terShift.h" 00031 #include "terAlignment.h" 00032 00033 00034 using namespace std; 00035 using namespace TERCPPNS_Tools; 00036 00037 namespace TERCPPNS_TERCpp 00038 { 00039 class bestShiftStruct 00040 { 00041 private: 00042 public: 00043 00044 // alignmentStruct(); 00045 // alignmentStruct (int _start, int _end, int _moveto, int _newloc); 00046 // alignmentStruct (int _start, int _end, int _moveto, int _newloc, vector<string> _shifted); 00047 // string toString(); 00048 // int distance() ; 00049 // bool leftShift(); 00050 // int size(); 00051 // alignmentStruct operator=(alignmentStruct t); 00052 // string vectorToString(vector<string> vec); 00053 00054 // int start; 00055 // int end; 00056 // int moveto; 00057 // int newloc; 00058 terShift * m_best_shift; 00059 terAlignment * m_best_align; 00060 bool * m_empty; 00061 bestShiftStruct(); 00062 ~bestShiftStruct(); 00063 inline void set(bestShiftStruct l_bestShiftStruct) { 00064 m_best_shift->set(l_bestShiftStruct.m_best_shift); 00065 m_best_align->set(l_bestShiftStruct.m_best_align); 00066 setEmpty(l_bestShiftStruct.getEmpty()); 00067 } 00068 inline void set(bestShiftStruct * l_bestShiftStruct) { 00069 m_best_shift->set(l_bestShiftStruct->m_best_shift); 00070 m_best_align->set(l_bestShiftStruct->m_best_align); 00071 setEmpty(l_bestShiftStruct->getEmpty()); 00072 } 00073 void setEmpty(bool b); 00074 void setBestShift(terShift * l_terShift); 00075 void setBestAlign(terAlignment * l_terAlignment); 00076 string toString(); 00077 bool getEmpty(); 00078 00079 // vector<string> nwords; // The words we shifted 00080 // char* alignment ; // for pra_more output 00081 // vector<vecInt> aftershift; // for pra_more output 00082 // This is used to store the cost of a shift, so we don't have to 00083 // calculate it multiple times. 00084 // double cost; 00085 }; 00086 00087 } 00088 #endif