Merge branch 'master' of github.com:moses-smt/mosesdecoder

This commit is contained in:
Barry Haddow 2013-07-25 15:56:44 +01:00
commit 29aa9ea153
7 changed files with 45 additions and 37 deletions

View File

@ -4,11 +4,12 @@
using namespace std;
namespace Moses {
namespace Moses
{
ControlRecombination::ControlRecombination(const std::string &line)
:StatefulFeatureFunction("ControlRecombination", 0, line)
,m_type(Output)
:StatefulFeatureFunction("ControlRecombination", 0, line)
,m_type(Output)
{
}
@ -44,12 +45,12 @@ const FFState* ControlRecombination::EmptyHypothesisState(const InputType &input
}
ControlRecombinationState::ControlRecombinationState()
:m_hypo(NULL)
:m_hypo(NULL)
{
}
ControlRecombinationState::ControlRecombinationState(const Hypothesis *hypo)
:m_hypo(hypo)
:m_hypo(hypo)
{
}

View File

@ -4,7 +4,8 @@
#include "StatefulFeatureFunction.h"
#include "moses/FF/FFState.h"
namespace Moses {
namespace Moses
{
class ControlRecombinationState;
@ -12,17 +13,16 @@ class ControlRecombinationState;
class ControlRecombination : public StatefulFeatureFunction
{
public:
enum Type
{
None,
Output,
Segmentation
};
enum Type {
None,
Output,
Segmentation
};
ControlRecombination(const std::string &line);
bool IsUseable(const FactorMask &mask) const {
return true;
return true;
}
virtual FFState* Evaluate(

View File

@ -42,7 +42,8 @@ LanguageModelRandLM::LanguageModelRandLM(const std::string &line)
{
}
LanguageModelRandLM::~LanguageModelRandLM() {
LanguageModelRandLM::~LanguageModelRandLM()
{
delete m_lm;
}
@ -100,7 +101,8 @@ randlm::WordID LanguageModelRandLM::GetLmID( const std::string &str ) const
return m_lm->getWordID(str);
}
randlm::WordID LanguageModelRandLM::GetLmID( const Factor *factor ) const {
randlm::WordID LanguageModelRandLM::GetLmID( const Factor *factor ) const
{
size_t factorId = factor->GetId();
return ( factorId >= m_randlm_ids_vec.size()) ? m_oov_id : m_randlm_ids_vec[factorId];
}
@ -127,10 +129,12 @@ LMResult LanguageModelRandLM::GetValue(const vector<const Word*> &contextFactor,
return ret;
}
void LanguageModelRandLM::InitializeForInput(InputType const& source) {
void LanguageModelRandLM::InitializeForInput(InputType const& source)
{
m_lm->initThreadSpecificData(); // Creates thread specific data iff // compiled with multithreading.
}
void LanguageModelRandLM::CleanUpAfterSentenceProcessing(const InputType& source) {
void LanguageModelRandLM::CleanUpAfterSentenceProcessing(const InputType& source)
{
m_lm->clearCaches(); // clear caches
}

View File

@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
namespace randlm
{
class RandLM;
class RandLM;
}
namespace Moses

View File

@ -174,12 +174,12 @@ Parameter::Parameter()
AddParam("lmodel-file", "DEPRECATED. DO NOT USE. location and properties of the language models");
AddParam("lmodel-dub", "DEPRECATED. DO NOT USE. dictionary upper bounds of language models");
#ifdef HAVE_SYNLM
#ifdef HAVE_SYNLM
AddParam("slmodel-file", "DEPRECATED. DO NOT USE. location of the syntactic language model file(s)");
AddParam("slmodel-factor", "DEPRECATED. DO NOT USE. factor to use with syntactic language model");
AddParam("slmodel-beam", "DEPRECATED. DO NOT USE. beam width to use with syntactic language model's parser");
#endif
AddParam("ttable-file", "DEPRECATED. DO NOT USE. location and properties of the translation tables");
AddParam("ttable-file", "DEPRECATED. DO NOT USE. location and properties of the translation tables");
AddParam("phrase-pair-feature", "DEPRECATED. DO NOT USE. Source and target factors for phrase pair feature");
AddParam("phrase-boundary-source-feature", "DEPRECATED. DO NOT USE. Source factors for phrase boundary feature");
AddParam("phrase-boundary-target-feature", "DEPRECATED. DO NOT USE. Target factors for phrase boundary feature");
@ -312,21 +312,21 @@ bool Parameter::LoadParam(int argc, char* argv[])
// don't mix old and new format
if ((isParamSpecified("feature") || isParamSpecified("weight"))
&& (isParamSpecified("weight-slm") || isParamSpecified("weight-bl") || isParamSpecified("weight-d") ||
isParamSpecified("weight-dlm") || isParamSpecified("weight-lrl") || isParamSpecified("weight-generation") ||
isParamSpecified("weight-i") || isParamSpecified("weight-l") || isParamSpecified("weight-lex") ||
isParamSpecified("weight-glm") || isParamSpecified("weight-wt") || isParamSpecified("weight-pp") ||
isParamSpecified("weight-pb") || isParamSpecified("weight-t") || isParamSpecified("weight-w") ||
isParamSpecified("weight-u") || isParamSpecified("weight-e") ||
isParamSpecified("dlm-mode") || isParamSpecified("generation-file") || isParamSpecified("global-lexical-file") ||
isParamSpecified("glm-feature") || isParamSpecified("lmodel-file") || isParamSpecified("lmodel-dub") ||
isParamSpecified("slmodel-file") || isParamSpecified("slmodel-factor") ||
isParamSpecified("slmodel-beam") || isParamSpecified("ttable-file") || isParamSpecified("phrase-pair-feature") ||
isParamSpecified("phrase-boundary-source-feature") || isParamSpecified("phrase-boundary-target-feature") || isParamSpecified("phrase-length-feature") ||
isParamSpecified("target-word-insertion-feature") || isParamSpecified("source-word-deletion-feature") || isParamSpecified("word-translation-feature")
)
) {
UTIL_THROW(util::Exception, "Don't mix old and new ini file format");
&& (isParamSpecified("weight-slm") || isParamSpecified("weight-bl") || isParamSpecified("weight-d") ||
isParamSpecified("weight-dlm") || isParamSpecified("weight-lrl") || isParamSpecified("weight-generation") ||
isParamSpecified("weight-i") || isParamSpecified("weight-l") || isParamSpecified("weight-lex") ||
isParamSpecified("weight-glm") || isParamSpecified("weight-wt") || isParamSpecified("weight-pp") ||
isParamSpecified("weight-pb") || isParamSpecified("weight-t") || isParamSpecified("weight-w") ||
isParamSpecified("weight-u") || isParamSpecified("weight-e") ||
isParamSpecified("dlm-mode") || isParamSpecified("generation-file") || isParamSpecified("global-lexical-file") ||
isParamSpecified("glm-feature") || isParamSpecified("lmodel-file") || isParamSpecified("lmodel-dub") ||
isParamSpecified("slmodel-file") || isParamSpecified("slmodel-factor") ||
isParamSpecified("slmodel-beam") || isParamSpecified("ttable-file") || isParamSpecified("phrase-pair-feature") ||
isParamSpecified("phrase-boundary-source-feature") || isParamSpecified("phrase-boundary-target-feature") || isParamSpecified("phrase-length-feature") ||
isParamSpecified("target-word-insertion-feature") || isParamSpecified("source-word-deletion-feature") || isParamSpecified("word-translation-feature")
)
) {
UTIL_THROW(util::Exception, "Don't mix old and new ini file format");
}
// convert old weights args to new format

View File

@ -21,7 +21,7 @@ sub run {
}
my $sourceLocale = $opts{s} || "";
my $targetLocale = $opts{t} || "";
my $numberSymbol = $opts{m} || '@NUM@';
my $numberSymbol = $opts{m} || '@num@';
while(<>) {
chomp;
print mark_numbers($_,$opts{c},$opts{l},$numberSymbol,$_),"\n";
@ -32,7 +32,7 @@ sub mark_numbers {
my $input = shift;
my $corpusMode = shift;
my $legacyMode = shift;
my $numberSymbol = shift || '@NUM@';
my $numberSymbol = shift || '@num@';
my $numref = recognize($input);
my $input_length = length($input);

View File

@ -28,6 +28,9 @@ sub Beautify($)
next if ($name eq "util");
next if ($name eq "lm");
next if ($name eq "search");
next if ($name eq "randlm");
next if ($name eq "srilm");
next if ($name eq "irstlm");
$name = $path ."/" .$name;
if (-d $name) {