daily automatic beautifier

This commit is contained in:
MosesAdmin 2016-02-13 00:02:04 +00:00
parent 1659d6b4c8
commit ca5178b684
6 changed files with 22 additions and 22 deletions

View File

@ -97,9 +97,9 @@ FFState* TargetConstituentAdjacencyFeature::EvaluateWhenApplied(
if (const PhraseProperty *property = currTarPhr.GetProperty("TargetConstituentBoundariesLeft")) { if (const PhraseProperty *property = currTarPhr.GetProperty("TargetConstituentBoundariesLeft")) {
const TargetConstituentBoundariesLeftPhraseProperty *targetConstituentBoundariesLeftPhraseProperty = const TargetConstituentBoundariesLeftPhraseProperty *targetConstituentBoundariesLeftPhraseProperty =
static_cast<const TargetConstituentBoundariesLeftPhraseProperty*>(property); static_cast<const TargetConstituentBoundariesLeftPhraseProperty*>(property);
const TargetConstituentBoundariesLeftCollection& leftConstituentCollection = const TargetConstituentBoundariesLeftCollection& leftConstituentCollection =
targetConstituentBoundariesLeftPhraseProperty->GetCollection(); targetConstituentBoundariesLeftPhraseProperty->GetCollection();
float prob = 0; float prob = 0;
size_t numMatch = 0; size_t numMatch = 0;
@ -111,7 +111,7 @@ FFState* TargetConstituentAdjacencyFeature::EvaluateWhenApplied(
++numOverall; ++numOverall;
FactorCollection &factorCollection = FactorCollection::Instance(); FactorCollection &factorCollection = FactorCollection::Instance();
const Factor* bosFactor = factorCollection.AddFactor("BOS_",false); const Factor* bosFactor = factorCollection.AddFactor("BOS_",false);
TargetConstituentBoundariesLeftCollection::const_iterator found = TargetConstituentBoundariesLeftCollection::const_iterator found =
leftConstituentCollection.find(bosFactor); leftConstituentCollection.find(bosFactor);
if ( found != leftConstituentCollection.end() ) { if ( found != leftConstituentCollection.end() ) {
++numMatch; ++numMatch;
@ -149,13 +149,13 @@ FFState* TargetConstituentAdjacencyFeature::EvaluateWhenApplied(
newScores[0] += TransformScore( (float)numMatch/numOverall ); newScores[0] += TransformScore( (float)numMatch/numOverall );
} }
} }
} else { } else {
// abort with error message if the phrase does not translate an unknown word // abort with error message if the phrase does not translate an unknown word
UTIL_THROW_IF2(!currTarPhr.GetWord(0).IsOOV(), GetScoreProducerDescription() UTIL_THROW_IF2(!currTarPhr.GetWord(0).IsOOV(), GetScoreProducerDescription()
<< ": Missing TargetConstituentBoundariesLeft property."); << ": Missing TargetConstituentBoundariesLeft property.");
++newScores[1]; ++newScores[1];
} }
@ -164,7 +164,7 @@ FFState* TargetConstituentAdjacencyFeature::EvaluateWhenApplied(
if (const PhraseProperty *property = currTarPhr.GetProperty("TargetConstituentBoundariesRightAdjacent")) { if (const PhraseProperty *property = currTarPhr.GetProperty("TargetConstituentBoundariesRightAdjacent")) {
const TargetConstituentBoundariesRightAdjacentPhraseProperty *targetConstituentBoundariesRightAdjacentPhraseProperty = const TargetConstituentBoundariesRightAdjacentPhraseProperty *targetConstituentBoundariesRightAdjacentPhraseProperty =
static_cast<const TargetConstituentBoundariesRightAdjacentPhraseProperty*>(property); static_cast<const TargetConstituentBoundariesRightAdjacentPhraseProperty*>(property);
const TargetConstituentBoundariesLeftCollection& rightAdjacentConstituentCollection = targetConstituentBoundariesRightAdjacentPhraseProperty->GetCollection(); const TargetConstituentBoundariesLeftCollection& rightAdjacentConstituentCollection = targetConstituentBoundariesRightAdjacentPhraseProperty->GetCollection();

View File

@ -27,10 +27,10 @@ void TargetConstituentBoundariesLeftPhraseProperty::ProcessValue(const std::stri
for ( std::vector<std::string>::iterator constituentIter = constituents.begin(); for ( std::vector<std::string>::iterator constituentIter = constituents.begin();
constituentIter != constituents.end(); ++constituentIter ) { constituentIter != constituents.end(); ++constituentIter ) {
const Factor* constituentFactor = factorCollection.AddFactor(*constituentIter,false); const Factor* constituentFactor = factorCollection.AddFactor(*constituentIter,false);
std::pair< std::set<const Factor* >::iterator, bool > dedupIns = std::pair< std::set<const Factor* >::iterator, bool > dedupIns =
dedup.insert(constituentFactor); dedup.insert(constituentFactor);
if ( dedupIns.second ) { if ( dedupIns.second ) {

View File

@ -8,14 +8,14 @@
namespace Moses namespace Moses
{ {
typedef std::map<const Factor*, float> TargetConstituentBoundariesLeftCollection; typedef std::map<const Factor*, float> TargetConstituentBoundariesLeftCollection;
class TargetConstituentBoundariesLeftPhraseProperty : public PhraseProperty class TargetConstituentBoundariesLeftPhraseProperty : public PhraseProperty
{ {
public: public:
TargetConstituentBoundariesLeftPhraseProperty() TargetConstituentBoundariesLeftPhraseProperty()
{}; {};
virtual void ProcessValue(const std::string &value); virtual void ProcessValue(const std::string &value);

View File

@ -27,10 +27,10 @@ void TargetConstituentBoundariesRightAdjacentPhraseProperty::ProcessValue(const
for ( std::vector<std::string>::iterator constituentIter = constituents.begin(); for ( std::vector<std::string>::iterator constituentIter = constituents.begin();
constituentIter != constituents.end(); ++constituentIter ) { constituentIter != constituents.end(); ++constituentIter ) {
const Factor* constituentFactor = factorCollection.AddFactor(*constituentIter,false); const Factor* constituentFactor = factorCollection.AddFactor(*constituentIter,false);
std::pair< std::set<const Factor* >::iterator, bool > dedupIns = std::pair< std::set<const Factor* >::iterator, bool > dedupIns =
dedup.insert(constituentFactor); dedup.insert(constituentFactor);
if ( dedupIns.second ) { if ( dedupIns.second ) {

View File

@ -8,14 +8,14 @@
namespace Moses namespace Moses
{ {
typedef std::map<const Factor*, float> TargetConstituentBoundariesRightAdjacentCollection; typedef std::map<const Factor*, float> TargetConstituentBoundariesRightAdjacentCollection;
class TargetConstituentBoundariesRightAdjacentPhraseProperty : public PhraseProperty class TargetConstituentBoundariesRightAdjacentPhraseProperty : public PhraseProperty
{ {
public: public:
TargetConstituentBoundariesRightAdjacentPhraseProperty() TargetConstituentBoundariesRightAdjacentPhraseProperty()
{}; {};
virtual void ProcessValue(const std::string &value); virtual void ProcessValue(const std::string &value);

View File

@ -303,7 +303,7 @@ int main(int argc, char* argv[])
SentenceAlignmentWithSyntax sentence SentenceAlignmentWithSyntax sentence
(targetLabelCollection, sourceLabelCollection, (targetLabelCollection, sourceLabelCollection,
targetTopLabelCollection, sourceTopLabelCollection, targetTopLabelCollection, sourceTopLabelCollection,
targetSyntax, false); targetSyntax, false);
// cout << "read in: " << englishString << " & " << foreignString << " & " << alignmentString << endl; // cout << "read in: " << englishString << " & " << foreignString << " & " << alignmentString << endl;
//az: output src, tgt, and alingment line //az: output src, tgt, and alingment line
@ -740,11 +740,11 @@ string getOrientString(REO_POS orient, REO_MODEL_TYPE modelType)
} }
return ""; return "";
} }
bool ExtractTask::checkTargetConstituentBoundaries( const SentenceAlignmentWithSyntax &sentence, bool ExtractTask::checkTargetConstituentBoundaries( const SentenceAlignmentWithSyntax &sentence,
int startE, int endE, int startF, int endF, int startE, int endE, int startF, int endF,
std::string &phrasePropertiesString) std::string &phrasePropertiesString)
{ {
ostringstream outextractstrPhrasePropertyTargetConstituentBoundariesLeft; ostringstream outextractstrPhrasePropertyTargetConstituentBoundariesLeft;
@ -814,8 +814,8 @@ bool ExtractTask::checkTargetConstituentBoundaries( const SentenceAlignmentWithS
if ( (relaxedStartE != startE) || (relaxedEndE !=endE) ) { if ( (relaxedStartE != startE) || (relaxedEndE !=endE) ) {
const std::vector< SyntaxNode* >& startingNodes = sentence.targetTree.GetNodesByStartPosition(relaxedStartE); const std::vector< SyntaxNode* >& startingNodes = sentence.targetTree.GetNodesByStartPosition(relaxedStartE);
for ( std::vector< SyntaxNode* >::const_reverse_iterator iter = startingNodes.rbegin(); for ( std::vector< SyntaxNode* >::const_reverse_iterator iter = startingNodes.rbegin();
(iter != startingNodes.rend() && !relaxedValidTargetConstituentBoundaries); (iter != startingNodes.rend() && !relaxedValidTargetConstituentBoundaries);
++iter ) { ++iter ) {
if ( (*iter)->end == relaxedEndE ) { if ( (*iter)->end == relaxedEndE ) {
relaxedValidTargetConstituentBoundaries = true; relaxedValidTargetConstituentBoundaries = true;
@ -868,8 +868,8 @@ bool ExtractTask::checkTargetConstituentBoundaries( const SentenceAlignmentWithS
} }
void ExtractTask::addPhrase( const SentenceAlignmentWithSyntax &sentence, void ExtractTask::addPhrase( const SentenceAlignmentWithSyntax &sentence,
int startE, int endE, int startF, int endF, int startE, int endE, int startF, int endF,
const std::string &orientationInfo, const std::string &orientationInfo,
const std::string &phrasePropertiesString) const std::string &phrasePropertiesString)
{ {