mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
daily automatic beautifier
This commit is contained in:
parent
a88e695c64
commit
c545b4160c
@ -19,7 +19,8 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
void TargetPreferencesFeatureState::AddProbabilityForLHSLabel(size_t label, double cost) {
|
||||
void TargetPreferencesFeatureState::AddProbabilityForLHSLabel(size_t label, double cost)
|
||||
{
|
||||
std::pair< std::map<size_t,double>::iterator, bool > inserted =
|
||||
m_probabilitiesForLHSLabels.insert(std::pair<size_t,double>(label,cost));
|
||||
if ( !inserted.second ) {
|
||||
@ -27,14 +28,16 @@ void TargetPreferencesFeatureState::AddProbabilityForLHSLabel(size_t label, doub
|
||||
}
|
||||
}
|
||||
|
||||
void TargetPreferencesFeatureState::NormalizeProbabilitiesForLHSLabels(double denominator) {
|
||||
void TargetPreferencesFeatureState::NormalizeProbabilitiesForLHSLabels(double denominator)
|
||||
{
|
||||
for ( std::map<size_t,double>::iterator iter=m_probabilitiesForLHSLabels.begin();
|
||||
iter!=m_probabilitiesForLHSLabels.end(); ++iter ) {
|
||||
(iter->second) /= denominator;
|
||||
}
|
||||
}
|
||||
|
||||
double TargetPreferencesFeatureState::GetProbabilityForLHSLabel(size_t label, bool &isMatch) const {
|
||||
double TargetPreferencesFeatureState::GetProbabilityForLHSLabel(size_t label, bool &isMatch) const
|
||||
{
|
||||
std::map<size_t,double>::const_iterator iter = m_probabilitiesForLHSLabels.find(label);
|
||||
if ( iter != m_probabilitiesForLHSLabels.end() ) {
|
||||
isMatch = true;
|
||||
@ -44,7 +47,8 @@ double TargetPreferencesFeatureState::GetProbabilityForLHSLabel(size_t label, bo
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t TargetPreferencesFeatureState::hash() const {
|
||||
size_t TargetPreferencesFeatureState::hash() const
|
||||
{
|
||||
if (!m_distinguishStates) {
|
||||
return 0;
|
||||
}
|
||||
@ -57,7 +61,8 @@ size_t TargetPreferencesFeatureState::hash() const {
|
||||
return ret;
|
||||
};
|
||||
|
||||
bool TargetPreferencesFeatureState::operator==(const FFState& other) const {
|
||||
bool TargetPreferencesFeatureState::operator==(const FFState& other) const
|
||||
{
|
||||
if (!m_distinguishStates) {
|
||||
return true;
|
||||
}
|
||||
@ -353,7 +358,7 @@ FFState* TargetPreferencesFeature::EvaluateWhenApplied(
|
||||
IFFEATUREVERBOSE(2) {
|
||||
FEATUREVERBOSE(2, "overallTreeProbability = " << overallTreeProbability);
|
||||
if ( overallTreeProbability > 1.0001 ) { // account for some rounding error
|
||||
FEATUREVERBOSE2(2, " -- WARNING: overallTreeProbability > 1");
|
||||
FEATUREVERBOSE2(2, " -- WARNING: overallTreeProbability > 1");
|
||||
}
|
||||
FEATUREVERBOSE2(2, std::endl);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user