Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Huck committed Feb 16, 2015
2 parents 8025cbf + a413074 commit 22df3e8
Show file tree
Hide file tree
Showing 27 changed files with 3,148 additions and 2,220 deletions.
26 changes: 7 additions & 19 deletions jam-files/sanity.jam
Expand Up @@ -137,24 +137,15 @@ rule boost-lib ( name macro : deps * ) {
main = "BOOST_AUTO_TEST_CASE(foo) {}" ;
flags += " -DBOOST_TEST_MODULE=CompileTest $(I-boost-include) -include boost/test/unit_test.hpp" ;
}
if $(boost-auto-shared) = "<link>shared" {
flags += " -DBOOST_$(macro)" ;
local default-linkage ;
if [ test_flags " -Wl,-Bstatic $(flags) -Wl,-Bdynamic " : $(main) ] {
default-linkage = "<link>static" ;
} else {
flags = " -Wl,-Bstatic $(flags) -Wl,-Bdynamic " ;
}
if [ test_flags $(flags) : $(main) ] {
lib inner_boost_$(name) : : <threading>single $(boost-search) <name>boost_$(name)$(boost-lib-version) : <link>static : <library>$(deps) ;
lib inner_boost_$(name) : : <threading>multi $(boost-search) <name>boost_$(name)$(boost-lib-version) : <link>static : <library>$(deps) ;
} else {
lib inner_boost_$(name) : : $(boost-search) <name>boost_$(name)$(boost-lib-version) : : <library>$(deps) ;
}

if $(boost-auto-shared) = "<link>shared" {
alias boost_$(name) : inner_boost_$(name) : <link>shared ;
default-linkage = "<link>shared" ;
requirements += <define>BOOST_$(macro) ;
} else {
alias boost_$(name) : inner_boost_$(name) : <link>static ;
}
lib boost_$(name) : $(deps) : <link>static $(boost-search) <name>boost_$(name)$(boost-lib-version) : $(default-linkage) ;
lib boost_$(name) : $(deps) : <link>shared $(boost-search) <name>boost_$(name)$(boost-lib-version) <define>BOOST_$(macro) : $(default-linkage) : <define>BOOST_$(macro) ;
}

#Argument is e.g. 103600
Expand All @@ -177,14 +168,11 @@ rule boost ( min-version ) {
boost-lib-version = "" ;
}

#Are we linking static binaries against shared boost?
boost-auto-shared = [ auto-shared "boost_program_options"$(boost-lib-version) : $(L-boost-search) ] ;

#See tools/build/v2/contrib/boost.jam in a boost distribution for a table of macros to define.
boost-lib system SYSTEM_DYN_LINK ;
boost-lib thread THREAD_DYN_DLL : boost_system ;
boost-lib program_options PROGRAM_OPTIONS_DYN_LINK ;
boost-lib unit_test_framework DELETE_ME_TEST_DYN_LINK ;
boost-lib unit_test_framework TEST_DYN_LINK ;
boost-lib iostreams IOSTREAMS_DYN_LINK ;
boost-lib filesystem FILE_SYSTEM_DYN_LINK ;
# if $(BOOST-VERSION) >= 104800 {
Expand Down
1 change: 1 addition & 0 deletions mert/Jamfile
Expand Up @@ -46,6 +46,7 @@ TER/infosHasher.cpp
TER/stringInfosHasher.cpp
TER/tercalc.cpp
TER/tools.cpp
TER/bestShiftStruct.cpp
TerScorer.cpp
CderScorer.cpp
MeteorScorer.cpp
Expand Down
27 changes: 18 additions & 9 deletions mert/TER/alignmentStruct.cpp
Expand Up @@ -5,7 +5,7 @@ Copyright 2010-2013, Christophe Servan, LIUM, University of Le Mans, France
Contact: christophe.servan@lium.univ-lemans.fr
The tercpp tool and library are free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the licence, or
(at your option) any later version.
Expand All @@ -21,17 +21,26 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "alignmentStruct.h"

using namespace std;
namespace TERCpp
namespace TERCPPNS_TERCpp
{
string alignmentStruct::toString()
{
stringstream s;
string alignmentStruct::toString()
{
stringstream s;
// s << "nword : " << vectorToString(nwords)<<endl;
// s << "alignment" << vectorToString(alignment)<<endl;
// s << "afterShift" << vectorToString(alignment)<<endl;
s << "Nothing to be printed" <<endl;
return s.str();
}
s << "Nothing to be printed" <<endl;
return s.str();
}
void alignmentStruct::set(alignmentStruct l_alignmentStruct)
{
nwords=l_alignmentStruct.nwords; // The words we shifted
alignment=l_alignmentStruct.alignment ; // for pra_more output
aftershift=l_alignmentStruct.aftershift; // for pra_more output
cost=l_alignmentStruct.cost;
}



// alignmentStruct::alignmentStruct()
// {
Expand Down Expand Up @@ -99,7 +108,7 @@ string alignmentStruct::toString()
// return s.str();
// }

/* The distance of the shift. */
/* The distance of the shift. */
// int alignmentStruct::distance()
// {
// if (moveto < start)
Expand Down
35 changes: 18 additions & 17 deletions mert/TER/alignmentStruct.h
Expand Up @@ -5,7 +5,7 @@ Copyright 2010-2013, Christophe Servan, LIUM, University of Le Mans, France
Contact: christophe.servan@lium.univ-lemans.fr
The tercpp tool and library are free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the licence, or
(at your option) any later version.
Expand All @@ -18,8 +18,8 @@ You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**********************************/
#ifndef MERT_TER_ALIGNMENTSTRUCT_H_
#define MERT_TER_ALIGNMENTSTRUCT_H_
#ifndef __TERCPPALIGNMENTSTRUCT_H__
#define __TERCPPALIGNMENTSTRUCT_H__


#include <vector>
Expand All @@ -30,14 +30,14 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


using namespace std;
using namespace Tools;
using namespace TERCPPNS_Tools;

namespace TERCpp
namespace TERCPPNS_TERCpp
{
class alignmentStruct
{
private:
public:
class alignmentStruct
{
private:
public:

// alignmentStruct();
// alignmentStruct (int _start, int _end, int _moveto, int _newloc);
Expand All @@ -53,14 +53,15 @@ class alignmentStruct
// int end;
// int moveto;
// int newloc;
vector<string> nwords; // The words we shifted
vector<char> alignment ; // for pra_more output
vector<vecInt> aftershift; // for pra_more output
// This is used to store the cost of a shift, so we don't have to
// calculate it multiple times.
double cost;
string toString();
};
vector<string> nwords; // The words we shifted
vector<char> alignment ; // for pra_more output
vector<vecInt> aftershift; // for pra_more output
// This is used to store the cost of a shift, so we don't have to
// calculate it multiple times.
double cost;
string toString();
void set(alignmentStruct l_alignmentStruct);
};

}
#endif
66 changes: 66 additions & 0 deletions mert/TER/bestShiftStruct.cpp
@@ -0,0 +1,66 @@
/*********************************
tercpp: an open-source Translation Edit Rate (TER) scorer tool for Machine Translation.
Copyright 2010-2013, Christophe Servan, LIUM, University of Le Mans, France
Contact: christophe.servan@lium.univ-lemans.fr
The tercpp tool and library are free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the licence, or
(at your option) any later version.
This program and library are distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**********************************/
#include "bestShiftStruct.h"

using namespace std;

namespace TERCPPNS_TERCpp
{
bestShiftStruct::bestShiftStruct()
{
m_best_shift=new terShift();
m_best_align=new terAlignment();
m_empty=new bool(false);
}
bestShiftStruct::~bestShiftStruct()
{
delete(m_best_align);
delete(m_best_shift);
}
void bestShiftStruct::setEmpty(bool b)
{
m_empty=new bool(b);
}
void bestShiftStruct::setBestShift(terShift * l_terShift)
{
m_best_shift->set(l_terShift);
}
void bestShiftStruct::setBestAlign(terAlignment * l_terAlignment)
{
m_best_align->set(l_terAlignment);
}
string bestShiftStruct::toString()
{
stringstream s;
s << m_best_shift->toString() << endl;
s << m_best_align->toString() << endl;
// s << (*m_empty) << endl;
}
bool bestShiftStruct::getEmpty()
{
return (*(m_empty));
}





}
52 changes: 36 additions & 16 deletions mert/TER/bestShiftStruct.h
Expand Up @@ -5,7 +5,7 @@ Copyright 2010-2013, Christophe Servan, LIUM, University of Le Mans, France
Contact: christophe.servan@lium.univ-lemans.fr
The tercpp tool and library are free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the licence, or
(at your option) any later version.
Expand All @@ -18,8 +18,8 @@ You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
**********************************/
#ifndef __BESTSHIFTSTRUCT_H_
#define __BESTSHIFTSTRUCT_H_
#ifndef __BESTSHIFTSTRUCT_H__
#define __BESTSHIFTSTRUCT_H__


#include <vector>
Expand All @@ -32,14 +32,14 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA


using namespace std;
using namespace Tools;
using namespace TERCPPNS_Tools;

namespace TERCpp
namespace TERCPPNS_TERCpp
{
class bestShiftStruct
{
private:
public:
class bestShiftStruct
{
private:
public:

// alignmentStruct();
// alignmentStruct (int _start, int _end, int _moveto, int _newloc);
Expand All @@ -55,16 +55,36 @@ class bestShiftStruct
// int end;
// int moveto;
// int newloc;
terShift m_best_shift;
terAlignment m_best_align;
bool m_empty;
terShift * m_best_shift;
terAlignment * m_best_align;
bool * m_empty;
bestShiftStruct();
~bestShiftStruct();
inline void set(bestShiftStruct l_bestShiftStruct)
{
m_best_shift->set(l_bestShiftStruct.m_best_shift);
m_best_align->set(l_bestShiftStruct.m_best_align);
setEmpty(l_bestShiftStruct.getEmpty());
}
inline void set(bestShiftStruct * l_bestShiftStruct)
{
m_best_shift->set(l_bestShiftStruct->m_best_shift);
m_best_align->set(l_bestShiftStruct->m_best_align);
setEmpty(l_bestShiftStruct->getEmpty());
}
void setEmpty(bool b);
void setBestShift(terShift * l_terShift);
void setBestAlign(terAlignment * l_terAlignment);
string toString();
bool getEmpty();

// vector<string> nwords; // The words we shifted
// char* alignment ; // for pra_more output
// vector<vecInt> aftershift; // for pra_more output
// This is used to store the cost of a shift, so we don't have to
// calculate it multiple times.
// This is used to store the cost of a shift, so we don't have to
// calculate it multiple times.
// double cost;
};
};

}
#endif
#endif

0 comments on commit 22df3e8

Please sign in to comment.