mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-25 21:03:22 +03:00
change to print the corrett name of the features with InputScores
git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@4168 1f5c12ca-751b-0410-a591-d2e778427230
This commit is contained in:
parent
ca1912961d
commit
75edc2eddd
@ -91,9 +91,6 @@
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
|
@ -359,77 +359,55 @@ void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const Cha
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string lastName = "";
|
||||
|
||||
// translation components
|
||||
if (StaticData::Instance().GetInputType()==SentenceInput) {
|
||||
// translation components for text input
|
||||
vector<PhraseDictionaryFeature*> pds = system->GetPhraseDictionaries();
|
||||
if (pds.size() > 0) {
|
||||
if (labeledOutput)
|
||||
out << "tm: ";
|
||||
vector<PhraseDictionaryFeature*>::iterator iter;
|
||||
for (iter = pds.begin(); iter != pds.end(); ++iter) {
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
for (size_t j = 0; j<scores.size(); ++j)
|
||||
out << scores[j] << " ";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// translation components for Confusion Network input
|
||||
// first translation component has GetNumInputScores() scores from the input Confusion Network
|
||||
// at the beginning of the vector
|
||||
vector<PhraseDictionaryFeature*> pds = system->GetPhraseDictionaries();
|
||||
if (pds.size() > 0) {
|
||||
vector<PhraseDictionaryFeature*>::iterator iter;
|
||||
const vector<PhraseDictionaryFeature*>& pds = system->GetPhraseDictionaries();
|
||||
if (pds.size() > 0) {
|
||||
|
||||
iter = pds.begin();
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
for( size_t i=0; i<pds.size(); i++ ) {
|
||||
size_t pd_numinputscore = pds[i]->GetNumInputScores();
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer( pds[i] );
|
||||
for (size_t j = 0; j<scores.size(); ++j){
|
||||
|
||||
size_t pd_numinputscore = (*iter)->GetNumInputScores();
|
||||
|
||||
if (pd_numinputscore) {
|
||||
|
||||
if (labeledOutput)
|
||||
out << "I: ";
|
||||
|
||||
for (size_t j = 0; j < pd_numinputscore; ++j)
|
||||
out << scores[j] << " ";
|
||||
}
|
||||
|
||||
|
||||
for (iter = pds.begin() ; iter != pds.end(); ++iter) {
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
|
||||
size_t pd_numinputscore = (*iter)->GetNumInputScores();
|
||||
|
||||
if (iter == pds.begin() && labeledOutput)
|
||||
out << "tm: ";
|
||||
for (size_t j = pd_numinputscore; j < scores.size() ; ++j)
|
||||
out << scores[j] << " ";
|
||||
}
|
||||
if (labeledOutput && (i == 0) ){
|
||||
if ((j == 0) || (j == pd_numinputscore)){
|
||||
lastName = pds[i]->GetScoreProducerWeightShortName(j);
|
||||
out << " " << lastName << ":";
|
||||
}
|
||||
}
|
||||
out << " " << scores[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// word penalty
|
||||
if (labeledOutput)
|
||||
out << "w: ";
|
||||
out << path.GetScoreBreakdown().GetScoreForProducer(system->GetWordPenaltyProducer()) << " ";
|
||||
|
||||
// generation
|
||||
const vector<GenerationDictionary*> gds = system->GetGenerationDictionaries();
|
||||
const vector<GenerationDictionary*>& gds = system->GetGenerationDictionaries();
|
||||
if (gds.size() > 0) {
|
||||
if (labeledOutput)
|
||||
out << "g: ";
|
||||
vector<GenerationDictionary*>::const_iterator iter;
|
||||
for (iter = gds.begin(); iter != gds.end(); ++iter) {
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
for (size_t j = 0; j<scores.size(); j++) {
|
||||
out << scores[j] << " ";
|
||||
}
|
||||
|
||||
for( size_t i=0; i<gds.size(); i++ ) {
|
||||
size_t pd_numinputscore = gds[i]->GetNumInputScores();
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer( gds[i] );
|
||||
for (size_t j = 0; j<scores.size(); ++j){
|
||||
|
||||
if (labeledOutput && (i == 0) ){
|
||||
if ((j == 0) || (j == pd_numinputscore)){
|
||||
lastName = gds[i]->GetScoreProducerWeightShortName(j);
|
||||
out << " " << lastName << ":";
|
||||
}
|
||||
}
|
||||
out << " " << scores[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// total
|
||||
out << "||| " << path.GetTotalScore();
|
||||
|
||||
|
@ -170,7 +170,7 @@ static void PrintFeatureWeight(const FeatureFunction* ff)
|
||||
size_t weightStart = StaticData::Instance().GetScoreIndexManager().GetBeginIndex(ff->GetScoreBookkeepingID());
|
||||
size_t weightEnd = StaticData::Instance().GetScoreIndexManager().GetEndIndex(ff->GetScoreBookkeepingID());
|
||||
for (size_t i = weightStart; i < weightEnd; ++i) {
|
||||
cout << ff->GetScoreProducerDescription() << " " << ff->GetScoreProducerWeightShortName() << " "
|
||||
cout << ff->GetScoreProducerDescription(i-weightStart) << " " << ff->GetScoreProducerWeightShortName(i-weightStart) << " "
|
||||
<< StaticData::Instance().GetAllWeights()[i] << endl;
|
||||
}
|
||||
}
|
||||
|
@ -383,8 +383,7 @@ void OutputNBest(std::ostream& out, const Moses::TrellisPathList &nBestList, con
|
||||
out << " |||";
|
||||
|
||||
std::string lastName = "";
|
||||
const vector<const StatefulFeatureFunction*>& sff =
|
||||
system->GetStatefulFeatureFunctions();
|
||||
const vector<const StatefulFeatureFunction*>& sff = system->GetStatefulFeatureFunctions();
|
||||
for( size_t i=0; i<sff.size(); i++ ) {
|
||||
if( labeledOutput && lastName != sff[i]->GetScoreProducerWeightShortName() ) {
|
||||
lastName = sff[i]->GetScoreProducerWeightShortName();
|
||||
@ -396,8 +395,7 @@ void OutputNBest(std::ostream& out, const Moses::TrellisPathList &nBestList, con
|
||||
}
|
||||
}
|
||||
|
||||
const vector<const StatelessFeatureFunction*>& slf =
|
||||
system->GetStatelessFeatureFunctions();
|
||||
const vector<const StatelessFeatureFunction*>& slf = system->GetStatelessFeatureFunctions();
|
||||
for( size_t i=0; i<slf.size(); i++ ) {
|
||||
if( labeledOutput && lastName != slf[i]->GetScoreProducerWeightShortName() ) {
|
||||
lastName = slf[i]->GetScoreProducerWeightShortName();
|
||||
@ -410,66 +408,42 @@ void OutputNBest(std::ostream& out, const Moses::TrellisPathList &nBestList, con
|
||||
}
|
||||
|
||||
// translation components
|
||||
if (StaticData::Instance().GetInputType()==SentenceInput) {
|
||||
// translation components for text input
|
||||
vector<PhraseDictionaryFeature*> pds = system->GetPhraseDictionaries();
|
||||
if (pds.size() > 0) {
|
||||
if (labeledOutput)
|
||||
out << " tm:";
|
||||
vector<PhraseDictionaryFeature*>::iterator iter;
|
||||
for (iter = pds.begin(); iter != pds.end(); ++iter) {
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
for (size_t j = 0; j<scores.size(); ++j)
|
||||
out << " " << scores[j];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// translation components for Confusion Network input
|
||||
// first translation component has GetNumInputScores() scores from the input Confusion Network
|
||||
// at the beginning of the vector
|
||||
vector<PhraseDictionaryFeature*> pds = system->GetPhraseDictionaries();
|
||||
if (pds.size() > 0) {
|
||||
vector<PhraseDictionaryFeature*>::iterator iter;
|
||||
const vector<PhraseDictionaryFeature*>& pds = system->GetPhraseDictionaries();
|
||||
if (pds.size() > 0) {
|
||||
|
||||
iter = pds.begin();
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
for( size_t i=0; i<pds.size(); i++ ) {
|
||||
size_t pd_numinputscore = pds[i]->GetNumInputScores();
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer( pds[i] );
|
||||
for (size_t j = 0; j<scores.size(); ++j){
|
||||
|
||||
size_t pd_numinputscore = (*iter)->GetNumInputScores();
|
||||
|
||||
if (pd_numinputscore) {
|
||||
|
||||
if (labeledOutput)
|
||||
out << " I:";
|
||||
|
||||
for (size_t j = 0; j < pd_numinputscore; ++j)
|
||||
out << " " << scores[j];
|
||||
}
|
||||
|
||||
|
||||
for (iter = pds.begin() ; iter != pds.end(); ++iter) {
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
|
||||
size_t pd_numinputscore = (*iter)->GetNumInputScores();
|
||||
|
||||
if (iter == pds.begin() && labeledOutput)
|
||||
out << " tm:";
|
||||
for (size_t j = pd_numinputscore; j < scores.size() ; ++j)
|
||||
out << " " << scores[j];
|
||||
}
|
||||
if (labeledOutput && (i == 0) ){
|
||||
if ((j == 0) || (j == pd_numinputscore)){
|
||||
lastName = pds[i]->GetScoreProducerWeightShortName(j);
|
||||
out << " " << lastName << ":";
|
||||
}
|
||||
}
|
||||
out << " " << scores[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// generation
|
||||
const vector<GenerationDictionary*> gds = system->GetGenerationDictionaries();
|
||||
const vector<GenerationDictionary*>& gds = system->GetGenerationDictionaries();
|
||||
if (gds.size() > 0) {
|
||||
if (labeledOutput)
|
||||
out << " g: ";
|
||||
vector<GenerationDictionary*>::const_iterator iter;
|
||||
for (iter = gds.begin(); iter != gds.end(); ++iter) {
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer(*iter);
|
||||
for (size_t j = 0; j<scores.size(); j++) {
|
||||
out << scores[j] << " ";
|
||||
}
|
||||
|
||||
for( size_t i=0; i<gds.size(); i++ ) {
|
||||
size_t pd_numinputscore = gds[i]->GetNumInputScores();
|
||||
vector<float> scores = path.GetScoreBreakdown().GetScoresForProducer( gds[i] );
|
||||
for (size_t j = 0; j<scores.size(); ++j){
|
||||
|
||||
if (labeledOutput && (i == 0) ){
|
||||
if ((j == 0) || (j == pd_numinputscore)){
|
||||
lastName = gds[i]->GetScoreProducerWeightShortName(j);
|
||||
out << " " << lastName << ":";
|
||||
}
|
||||
}
|
||||
out << " " << scores[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ static void PrintFeatureWeight(const FeatureFunction* ff)
|
||||
size_t weightStart = StaticData::Instance().GetScoreIndexManager().GetBeginIndex(ff->GetScoreBookkeepingID());
|
||||
size_t weightEnd = StaticData::Instance().GetScoreIndexManager().GetEndIndex(ff->GetScoreBookkeepingID());
|
||||
for (size_t i = weightStart; i < weightEnd; ++i) {
|
||||
cout << ff->GetScoreProducerDescription() << " " << ff->GetScoreProducerWeightShortName() << " "
|
||||
cout << ff->GetScoreProducerDescription(i-weightStart) << " " << ff->GetScoreProducerWeightShortName(i-weightStart) << " "
|
||||
<< StaticData::Instance().GetAllWeights()[i] << endl;
|
||||
}
|
||||
}
|
||||
@ -335,6 +335,7 @@ int main(int argc, char** argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
// create threadpool, if using multi-threaded decoding
|
||||
// note: multi-threading is done on sentence-level,
|
||||
// each thread translates one sentence
|
||||
|
@ -48,12 +48,12 @@ size_t DistortionScoreProducer::GetNumScoreComponents() const
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string DistortionScoreProducer::GetScoreProducerDescription() const
|
||||
std::string DistortionScoreProducer::GetScoreProducerDescription(unsigned) const
|
||||
{
|
||||
return "Distortion";
|
||||
}
|
||||
|
||||
std::string DistortionScoreProducer::GetScoreProducerWeightShortName() const
|
||||
std::string DistortionScoreProducer::GetScoreProducerWeightShortName(unsigned) const
|
||||
{
|
||||
return "d";
|
||||
}
|
||||
@ -119,12 +119,12 @@ size_t WordPenaltyProducer::GetNumScoreComponents() const
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string WordPenaltyProducer::GetScoreProducerDescription() const
|
||||
std::string WordPenaltyProducer::GetScoreProducerDescription(unsigned) const
|
||||
{
|
||||
return "WordPenalty";
|
||||
}
|
||||
|
||||
std::string WordPenaltyProducer::GetScoreProducerWeightShortName() const
|
||||
std::string WordPenaltyProducer::GetScoreProducerWeightShortName(unsigned) const
|
||||
{
|
||||
return "w";
|
||||
}
|
||||
@ -149,12 +149,12 @@ size_t UnknownWordPenaltyProducer::GetNumScoreComponents() const
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string UnknownWordPenaltyProducer::GetScoreProducerDescription() const
|
||||
std::string UnknownWordPenaltyProducer::GetScoreProducerDescription(unsigned) const
|
||||
{
|
||||
return "!UnknownWordPenalty";
|
||||
}
|
||||
|
||||
std::string UnknownWordPenaltyProducer::GetScoreProducerWeightShortName() const
|
||||
std::string UnknownWordPenaltyProducer::GetScoreProducerWeightShortName(unsigned) const
|
||||
{
|
||||
return "u";
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ public:
|
||||
const WordsRange &prev, const WordsRange &curr, const int FirstGapPosition) const;
|
||||
|
||||
size_t GetNumScoreComponents() const;
|
||||
std::string GetScoreProducerDescription() const;
|
||||
std::string GetScoreProducerWeightShortName() const;
|
||||
std::string GetScoreProducerDescription(unsigned) const;
|
||||
std::string GetScoreProducerWeightShortName(unsigned) const;
|
||||
size_t GetNumInputScores() const;
|
||||
|
||||
virtual const FFState* EmptyHypothesisState(const InputType &input) const;
|
||||
@ -50,8 +50,8 @@ public:
|
||||
WordPenaltyProducer(ScoreIndexManager &scoreIndexManager);
|
||||
|
||||
size_t GetNumScoreComponents() const;
|
||||
std::string GetScoreProducerDescription() const;
|
||||
std::string GetScoreProducerWeightShortName() const;
|
||||
std::string GetScoreProducerDescription(unsigned) const;
|
||||
std::string GetScoreProducerWeightShortName(unsigned) const;
|
||||
size_t GetNumInputScores() const;
|
||||
|
||||
virtual void Evaluate(
|
||||
@ -66,8 +66,8 @@ public:
|
||||
UnknownWordPenaltyProducer(ScoreIndexManager &scoreIndexManager);
|
||||
|
||||
size_t GetNumScoreComponents() const;
|
||||
std::string GetScoreProducerDescription() const;
|
||||
std::string GetScoreProducerWeightShortName() const;
|
||||
std::string GetScoreProducerDescription(unsigned) const;
|
||||
std::string GetScoreProducerWeightShortName(unsigned) const;
|
||||
size_t GetNumInputScores() const;
|
||||
|
||||
virtual bool ComputeValueInTranslationOption() const;
|
||||
|
@ -123,11 +123,17 @@ size_t GenerationDictionary::GetNumScoreComponents() const
|
||||
return m_numScoreComponent;
|
||||
}
|
||||
|
||||
std::string GenerationDictionary::GetScoreProducerDescription() const
|
||||
std::string GenerationDictionary::GetScoreProducerDescription(unsigned) const
|
||||
{
|
||||
return "Generation score, file=" + m_filePath;
|
||||
}
|
||||
|
||||
std::string GenerationDictionary::GetScoreProducerWeightShortName(unsigned) const
|
||||
{
|
||||
return "g";
|
||||
}
|
||||
|
||||
|
||||
const OutputWordCollection *GenerationDictionary::FindWord(const Word &word) const
|
||||
{
|
||||
const OutputWordCollection *ret;
|
||||
|
@ -71,10 +71,8 @@ public:
|
||||
bool Load(const std::string &filePath, FactorDirection direction);
|
||||
|
||||
size_t GetNumScoreComponents() const;
|
||||
std::string GetScoreProducerDescription() const;
|
||||
std::string GetScoreProducerWeightShortName() const {
|
||||
return "g";
|
||||
}
|
||||
std::string GetScoreProducerDescription(unsigned) const;
|
||||
std::string GetScoreProducerWeightShortName(unsigned) const;
|
||||
|
||||
/** number of unique input entries in the generation table.
|
||||
* NOT the number of lines in the generation table
|
||||
|
@ -58,11 +58,11 @@ public:
|
||||
return 1;
|
||||
};
|
||||
|
||||
virtual std::string GetScoreProducerDescription() const {
|
||||
virtual std::string GetScoreProducerDescription(unsigned) const {
|
||||
return "GlobalLexicalModel";
|
||||
};
|
||||
|
||||
virtual std::string GetScoreProducerWeightShortName() const {
|
||||
virtual std::string GetScoreProducerWeightShortName(unsigned) const {
|
||||
return "lex";
|
||||
};
|
||||
|
||||
|
@ -95,13 +95,13 @@ public:
|
||||
return m_implementation->GetNGramOrder();
|
||||
}
|
||||
|
||||
virtual std::string GetScoreProducerDescription() const {
|
||||
return m_implementation->GetScoreProducerDescription();
|
||||
virtual std::string GetScoreProducerDescription(unsigned idx=0) const {
|
||||
return m_implementation->GetScoreProducerDescription(idx);
|
||||
}
|
||||
|
||||
float GetWeight() const;
|
||||
|
||||
std::string GetScoreProducerWeightShortName() const {
|
||||
std::string GetScoreProducerWeightShortName(unsigned) const {
|
||||
return "lm";
|
||||
}
|
||||
|
||||
|
@ -109,11 +109,11 @@ public:
|
||||
return m_sentenceEndArray;
|
||||
}
|
||||
|
||||
virtual std::string GetScoreProducerDescription() const = 0;
|
||||
virtual std::string GetScoreProducerDescription(unsigned) const = 0;
|
||||
|
||||
float GetWeight() const;
|
||||
|
||||
std::string GetScoreProducerWeightShortName() const {
|
||||
std::string GetScoreProducerWeightShortName(unsigned) const {
|
||||
return "lm";
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
std::string LanguageModelMultiFactor::GetScoreProducerDescription() const
|
||||
std::string LanguageModelMultiFactor::GetScoreProducerDescription(unsigned) const
|
||||
{
|
||||
std::ostringstream oss;
|
||||
// what about LMs that are over multiple factors at once, POS + stem, for example?
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
return MultiFactor;
|
||||
}
|
||||
|
||||
std::string GetScoreProducerDescription() const;
|
||||
std::string GetScoreProducerDescription(unsigned) const;
|
||||
bool Useable(const Phrase &phrase) const;
|
||||
};
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace Moses
|
||||
LanguageModelSingleFactor::~LanguageModelSingleFactor() {}
|
||||
|
||||
|
||||
std::string LanguageModelSingleFactor::GetScoreProducerDescription() const
|
||||
std::string LanguageModelSingleFactor::GetScoreProducerDescription(unsigned) const
|
||||
{
|
||||
std::ostringstream oss;
|
||||
// what about LMs that are over multiple factors at once, POS + stem, for example?
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
FactorType GetFactorType() const {
|
||||
return m_factorType;
|
||||
}
|
||||
std::string GetScoreProducerDescription() const;
|
||||
std::string GetScoreProducerDescription(unsigned) const;
|
||||
};
|
||||
|
||||
// Single factor LM that uses a null pointer state.
|
||||
|
@ -49,11 +49,11 @@ public:
|
||||
|
||||
virtual const FFState* EmptyHypothesisState(const InputType &input) const;
|
||||
|
||||
virtual std::string GetScoreProducerDescription() const {
|
||||
virtual std::string GetScoreProducerDescription(unsigned) const {
|
||||
return "LexicalReordering_" + m_modelTypeString;
|
||||
}
|
||||
|
||||
std::string GetScoreProducerWeightShortName() const {
|
||||
std::string GetScoreProducerWeightShortName(unsigned) const {
|
||||
return "d";
|
||||
};
|
||||
|
||||
|
@ -214,9 +214,22 @@ PhraseDictionaryFeature::~PhraseDictionaryFeature()
|
||||
{}
|
||||
|
||||
|
||||
std::string PhraseDictionaryFeature::GetScoreProducerDescription() const
|
||||
std::string PhraseDictionaryFeature::GetScoreProducerDescription(unsigned idx) const
|
||||
{
|
||||
return "PhraseModel";
|
||||
if (idx < GetNumInputScores()){
|
||||
return "InputScore";
|
||||
}else{
|
||||
return "PhraseModel";
|
||||
}
|
||||
}
|
||||
|
||||
std::string PhraseDictionaryFeature::GetScoreProducerWeightShortName(unsigned idx) const
|
||||
{
|
||||
if (idx < GetNumInputScores()){
|
||||
return "I";
|
||||
}else{
|
||||
return "tm";
|
||||
}
|
||||
}
|
||||
|
||||
size_t PhraseDictionaryFeature::GetNumScoreComponents() const
|
||||
|
@ -112,10 +112,9 @@ public:
|
||||
|
||||
virtual bool ComputeValueInTranslationOption() const;
|
||||
|
||||
std::string GetScoreProducerDescription() const;
|
||||
std::string GetScoreProducerWeightShortName() const {
|
||||
return "tm";
|
||||
}
|
||||
std::string GetScoreProducerDescription(unsigned) const;
|
||||
std::string GetScoreProducerWeightShortName(unsigned idx=0) const;
|
||||
|
||||
size_t GetNumScoreComponents() const;
|
||||
|
||||
size_t GetNumInputScores() const;
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
const LMList& languageModels,
|
||||
const WordPenaltyProducer* wpProducer);
|
||||
|
||||
std::string GetScoreProducerDescription() const {
|
||||
std::string GetScoreProducerDescription(unsigned) const {
|
||||
return "BerkeleyPt";
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public:
|
||||
}
|
||||
virtual ~PhraseDictionarySCFG();
|
||||
|
||||
std::string GetScoreProducerDescription() const {
|
||||
std::string GetScoreProducerDescription(unsigned) const {
|
||||
return "Hieu's Reordering Model";
|
||||
}
|
||||
|
||||
|
@ -661,7 +661,7 @@ GetTargetCandidates(PrefixPtr p,
|
||||
imp->ConvertTgtCand(tcands,rv,wa);
|
||||
}
|
||||
|
||||
std::string PhraseDictionaryTree::GetScoreProducerDescription() const
|
||||
std::string PhraseDictionaryTree::GetScoreProducerDescription(unsigned) const
|
||||
{
|
||||
return "PhraseDictionaryTree";
|
||||
}
|
||||
|
@ -122,8 +122,8 @@ public:
|
||||
// print target candidates for a given prefix pointer to a stream, mainly
|
||||
// for debugging
|
||||
void PrintTargetCandidates(PrefixPtr p,std::ostream& out) const;
|
||||
std::string GetScoreProducerDescription() const;
|
||||
std::string GetScoreProducerWeightShortName() const {
|
||||
std::string GetScoreProducerDescription(unsigned) const;
|
||||
std::string GetScoreProducerWeightShortName(unsigned) const {
|
||||
return "tm";
|
||||
}
|
||||
};
|
||||
|
@ -105,11 +105,21 @@ size_t PhraseDictionaryTreeAdaptor::GetNumInputScores() const
|
||||
return imp->GetNumInputScores();
|
||||
}
|
||||
|
||||
std::string PhraseDictionaryTreeAdaptor::GetScoreProducerDescription() const
|
||||
std::string PhraseDictionaryTreeAdaptor::GetScoreProducerDescription(unsigned idx) const{
|
||||
if (idx < imp->GetNumInputScores()){
|
||||
return "InputScore";
|
||||
}else{
|
||||
return "PhraseModel";
|
||||
}
|
||||
}
|
||||
|
||||
std::string PhraseDictionaryTreeAdaptor::GetScoreProducerWeightShortName(unsigned idx) const
|
||||
{
|
||||
return "PhraseModel";
|
||||
if (idx < imp->GetNumInputScores()){
|
||||
return "I";
|
||||
}else{
|
||||
return "tm";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,10 +60,8 @@ public:
|
||||
// this function can be only used for UNKNOWN source phrases
|
||||
void AddEquivPhrase(const Phrase &source, const TargetPhrase &targetPhrase);
|
||||
|
||||
std::string GetScoreProducerDescription() const;
|
||||
std::string GetScoreProducerWeightShortName() const {
|
||||
return "tm";
|
||||
}
|
||||
std::string GetScoreProducerDescription(unsigned idx=0) const;
|
||||
std::string GetScoreProducerWeightShortName(unsigned idx=0) const;
|
||||
|
||||
size_t GetNumInputScores() const;
|
||||
virtual void InitializeForInput(InputType const& source);
|
||||
|
@ -67,7 +67,7 @@ void ScoreIndexManager::InitFeatureNames()
|
||||
bool add_idx = (m_producers[cur_scoreType]->GetNumInputScores() > 1);
|
||||
while (nis_idx < m_producers[cur_scoreType]->GetNumInputScores()) {
|
||||
ostringstream os;
|
||||
os << m_producers[cur_scoreType]->GetScoreProducerDescription();
|
||||
os << m_producers[cur_scoreType]->GetScoreProducerDescription(nis_idx);
|
||||
if (add_idx)
|
||||
os << '_' << (nis_idx+1);
|
||||
m_featureNames.push_back(os.str());
|
||||
@ -79,11 +79,11 @@ void ScoreIndexManager::InitFeatureNames()
|
||||
add_idx = (m_ends[cur_scoreType] - cur_i > 1);
|
||||
while (cur_i < m_ends[cur_scoreType]) {
|
||||
ostringstream os;
|
||||
os << m_producers[cur_scoreType]->GetScoreProducerDescription();
|
||||
os << m_producers[cur_scoreType]->GetScoreProducerDescription(nis_idx+ind-1);
|
||||
if (add_idx)
|
||||
os << '_' << ind;
|
||||
m_featureNames.push_back(os.str());
|
||||
m_featureShortNames.push_back( m_producers[cur_scoreType]->GetScoreProducerWeightShortName() );
|
||||
m_featureShortNames.push_back( m_producers[cur_scoreType]->GetScoreProducerWeightShortName(nis_idx+ind-1) );
|
||||
++cur_i;
|
||||
++ind;
|
||||
}
|
||||
|
@ -50,10 +50,10 @@ public:
|
||||
virtual size_t GetNumScoreComponents() const = 0;
|
||||
|
||||
//! returns a string description of this producer
|
||||
virtual std::string GetScoreProducerDescription() const = 0;
|
||||
virtual std::string GetScoreProducerDescription(unsigned idx=0) const = 0;
|
||||
|
||||
//! returns the weight parameter name of this producer (used in n-best list)
|
||||
virtual std::string GetScoreProducerWeightShortName() const = 0;
|
||||
virtual std::string GetScoreProducerWeightShortName(unsigned idx=0) const = 0;
|
||||
|
||||
//! returns the number of scores gathered from the input (0 by default)
|
||||
virtual size_t GetNumInputScores() const {
|
||||
|
@ -36,11 +36,11 @@ namespace Moses
|
||||
return m_NumScoreComponents;
|
||||
}
|
||||
|
||||
std::string SyntacticLanguageModel::GetScoreProducerDescription() const {
|
||||
std::string SyntacticLanguageModel::GetScoreProducerDescription(unsigned) const {
|
||||
return "Syntactic Language Model";
|
||||
}
|
||||
|
||||
std::string SyntacticLanguageModel::GetScoreProducerWeightShortName() const {
|
||||
std::string SyntacticLanguageModel::GetScoreProducerWeightShortName(unsigned) const {
|
||||
return "slm";
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,8 @@ namespace Moses
|
||||
~SyntacticLanguageModel();
|
||||
|
||||
size_t GetNumScoreComponents() const;
|
||||
std::string GetScoreProducerDescription() const;
|
||||
std::string GetScoreProducerWeightShortName() const;
|
||||
std::string GetScoreProducerDescription(unsigned) const;
|
||||
std::string GetScoreProducerWeightShortName(unsigned) const;
|
||||
|
||||
const FFState* EmptyHypothesisState(const InputType &input) const;
|
||||
|
||||
|
@ -96,8 +96,7 @@ void TranslationSystem::AddFeatureFunction(const FeatureFunction* ff)
|
||||
|
||||
void TranslationSystem::ConfigDictionaries()
|
||||
{
|
||||
for (vector<DecodeGraph*>::const_iterator i = m_decodeGraphs.begin();
|
||||
i != m_decodeGraphs.end(); ++i) {
|
||||
for (vector<DecodeGraph*>::const_iterator i = m_decodeGraphs.begin(); i != m_decodeGraphs.end(); ++i) {
|
||||
for (DecodeGraph::const_iterator j = (*i)->begin(); j != (*i)->end(); ++j) {
|
||||
const DecodeStep* step = *j;
|
||||
PhraseDictionaryFeature* pdict = const_cast<PhraseDictionaryFeature*>(step->GetPhraseDictionaryFeature());
|
||||
|
Loading…
Reference in New Issue
Block a user