mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-06 19:49:41 +03:00
Merge branch 'master' of git://github.com/moses-smt/mosesdecoder
This commit is contained in:
commit
382cbf1113
@ -48,7 +48,7 @@ System::System(const Parameter ¶msArg) :
|
||||
if (params.GetParam("show-weights")) {
|
||||
cerr << "Showing weights then exit" << endl;
|
||||
featureFunctions.ShowWeights(weights);
|
||||
return;
|
||||
//return;
|
||||
}
|
||||
|
||||
cerr << "START featureFunctions.Load()" << endl;
|
||||
|
@ -54,16 +54,21 @@ LMResult NeuralLMWrapper::GetValue(const vector<const Word*> &contextFactor, Sta
|
||||
//TODO: config option?
|
||||
m_neuralLM->set_cache(1000000);
|
||||
}
|
||||
size_t hashCode = 0;
|
||||
|
||||
|
||||
vector<int> words(contextFactor.size());
|
||||
for (size_t i=0, n=contextFactor.size(); i<n; i++) {
|
||||
const size_t n = contextFactor.size();
|
||||
for (size_t i=0; i<n; i++) {
|
||||
const Word* word = contextFactor[i];
|
||||
const Factor* factor = word->GetFactor(m_factorType);
|
||||
const std::string string = factor->GetString().as_string();
|
||||
int neuralLM_wordID = m_neuralLM->lookup_word(string);
|
||||
words[i] = neuralLM_wordID;
|
||||
boost::hash_combine(hashCode, neuralLM_wordID);
|
||||
}
|
||||
// Generate hashCode for only the last n-1 words, that represents the next LM
|
||||
// state
|
||||
size_t hashCode = 0;
|
||||
for (size_t i=1; i<n; ++i) {
|
||||
boost::hash_combine(hashCode, words[i]);
|
||||
}
|
||||
|
||||
double value = m_neuralLM->lookup_ngram(words);
|
||||
|
@ -1680,7 +1680,7 @@ sub score_phrase_phrase_extract {
|
||||
|
||||
# distinguish between score and consolidation options
|
||||
my $ONLY_DIRECT = (defined($_SCORE_OPTIONS) && $_SCORE_OPTIONS =~ /OnlyDirect/);
|
||||
my $PHRASE_COUNT = (!defined($_SCORE_OPTIONS) || $_SCORE_OPTIONS !~ /NoPhraseCount/);
|
||||
my $PHRASE_COUNT = (defined($_SCORE_OPTIONS) && $_SCORE_OPTIONS =~ /PhraseCount/);
|
||||
my $LOW_COUNT = (defined($_SCORE_OPTIONS) && $_SCORE_OPTIONS =~ /LowCountFeature/);
|
||||
my ($SPARSE_COUNT_BIN,$COUNT_BIN,$DOMAIN) = ("","","");
|
||||
$SPARSE_COUNT_BIN = $1 if defined($_SCORE_OPTIONS) && $_SCORE_OPTIONS =~ /SparseCountBinFeature ([\s\d]*\d)/;
|
||||
@ -1814,7 +1814,7 @@ sub score_phrase_phrase_extract {
|
||||
$cmd .= " --LogProb" if $LOG_PROB;
|
||||
$cmd .= " --NegLogProb" if $NEG_LOG_PROB;
|
||||
$cmd .= " --OnlyDirect" if $ONLY_DIRECT;
|
||||
$cmd .= " --NoPhraseCount" unless $PHRASE_COUNT;
|
||||
$cmd .= " --PhraseCount" if $PHRASE_COUNT;
|
||||
$cmd .= " --LowCountFeature" if $LOW_COUNT;
|
||||
$cmd .= " --CountBinFeature $COUNT_BIN" if $COUNT_BIN;
|
||||
$cmd .= " --SparseCountBinFeature $SPARSE_COUNT_BIN" if $SPARSE_COUNT_BIN;
|
||||
|
Loading…
Reference in New Issue
Block a user