mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
beautify
This commit is contained in:
parent
bddbdeec04
commit
600a188a4e
@ -147,25 +147,25 @@ void DecodeStepTranslation::ProcessInitialTranslation(
|
||||
const WordsRange wordsRange(startPos, endPos);
|
||||
|
||||
if (phraseColl != NULL) {
|
||||
IFVERBOSE(3) {
|
||||
if(StaticData::Instance().GetInputType() == SentenceInput)
|
||||
TRACE_ERR("[" << source.GetSubString(wordsRange) << "; " << startPos << "-" << endPos << "]\n");
|
||||
else
|
||||
TRACE_ERR("[" << startPos << "-" << endPos << "]" << std::endl);
|
||||
}
|
||||
IFVERBOSE(3) {
|
||||
if(StaticData::Instance().GetInputType() == SentenceInput)
|
||||
TRACE_ERR("[" << source.GetSubString(wordsRange) << "; " << startPos << "-" << endPos << "]\n");
|
||||
else
|
||||
TRACE_ERR("[" << startPos << "-" << endPos << "]" << std::endl);
|
||||
}
|
||||
|
||||
TargetPhraseCollection::const_iterator iterTargetPhrase, iterEnd;
|
||||
iterEnd = (!adhereTableLimit || tableLimit == 0 || phraseColl->GetSize() < tableLimit) ? phraseColl->end() : phraseColl->begin() + tableLimit;
|
||||
TargetPhraseCollection::const_iterator iterTargetPhrase, iterEnd;
|
||||
iterEnd = (!adhereTableLimit || tableLimit == 0 || phraseColl->GetSize() < tableLimit) ? phraseColl->end() : phraseColl->begin() + tableLimit;
|
||||
|
||||
for (iterTargetPhrase = phraseColl->begin() ; iterTargetPhrase != iterEnd ; ++iterTargetPhrase) {
|
||||
const TargetPhrase &targetPhrase = **iterTargetPhrase;
|
||||
TranslationOption *transOpt = new TranslationOption(wordsRange, targetPhrase);
|
||||
for (iterTargetPhrase = phraseColl->begin() ; iterTargetPhrase != iterEnd ; ++iterTargetPhrase) {
|
||||
const TargetPhrase &targetPhrase = **iterTargetPhrase;
|
||||
TranslationOption *transOpt = new TranslationOption(wordsRange, targetPhrase);
|
||||
|
||||
outputPartialTranslOptColl.Add (transOpt);
|
||||
outputPartialTranslOptColl.Add (transOpt);
|
||||
|
||||
VERBOSE(3,"\t" << targetPhrase << "\n");
|
||||
}
|
||||
VERBOSE(3,std::endl);
|
||||
VERBOSE(3,"\t" << targetPhrase << "\n");
|
||||
}
|
||||
VERBOSE(3,std::endl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -39,10 +39,11 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
const TargetPhraseCollection *InputLatticeNode::GetTargetPhrases(const PhraseDictionary &phraseDictionary) const {
|
||||
std::map<const PhraseDictionary*, const TargetPhraseCollection *>::const_iterator iter;
|
||||
iter = m_targetPhrases.find(&phraseDictionary);
|
||||
CHECK(iter != m_targetPhrases.end());
|
||||
const TargetPhraseCollection *InputLatticeNode::GetTargetPhrases(const PhraseDictionary &phraseDictionary) const
|
||||
{
|
||||
std::map<const PhraseDictionary*, const TargetPhraseCollection *>::const_iterator iter;
|
||||
iter = m_targetPhrases.find(&phraseDictionary);
|
||||
CHECK(iter != m_targetPhrases.end());
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ protected:
|
||||
|
||||
public:
|
||||
InputLatticeNode()
|
||||
:m_range(NOT_FOUND, NOT_FOUND)
|
||||
:m_range(NOT_FOUND, NOT_FOUND)
|
||||
{}
|
||||
InputLatticeNode(const Phrase &phrase, const WordsRange &range)
|
||||
:m_phrase(phrase)
|
||||
|
@ -19,10 +19,10 @@ public:
|
||||
|
||||
void ProcessUnknownWord(size_t sourcePos);
|
||||
void CreateTranslationOptionsForRange(const DecodeGraph &decodeStepList
|
||||
, size_t startPosition
|
||||
, size_t endPosition
|
||||
, bool adhereTableLimit
|
||||
, size_t graphInd);
|
||||
, size_t startPosition
|
||||
, size_t endPosition
|
||||
, bool adhereTableLimit
|
||||
, size_t graphInd);
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -38,23 +38,23 @@ TranslationOptionCollectionText::TranslationOptionCollectionText(Sentence const
|
||||
size_t size = input.GetSize();
|
||||
m_targetPhrasesfromPt.resize(size);
|
||||
for (size_t startPos = 0; startPos < size; ++startPos) {
|
||||
std::vector<InputLatticeNode> &vec = m_targetPhrasesfromPt[startPos];
|
||||
for (size_t endPos = startPos; endPos < size; ++endPos) {
|
||||
Phrase subphrase(input.GetSubString(WordsRange(startPos, endPos)));
|
||||
WordsRange range(startPos, endPos);
|
||||
InputLatticeNode node(subphrase, range);
|
||||
std::vector<InputLatticeNode> &vec = m_targetPhrasesfromPt[startPos];
|
||||
for (size_t endPos = startPos; endPos < size; ++endPos) {
|
||||
Phrase subphrase(input.GetSubString(WordsRange(startPos, endPos)));
|
||||
WordsRange range(startPos, endPos);
|
||||
InputLatticeNode node(subphrase, range);
|
||||
|
||||
vec.push_back(node);
|
||||
}
|
||||
vec.push_back(node);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t phaseSize = 1; phaseSize <= size; ++phaseSize) {
|
||||
for (size_t startPos = 0; startPos < size - phaseSize + 1; ++startPos) {
|
||||
size_t endPos = startPos + phaseSize -1;
|
||||
//cerr << startPos << "-" << endPos << "=" << GetPhrase(startPos, endPos) << endl;
|
||||
InputLatticeNode &node = GetInputLatticeNode(startPos, endPos);
|
||||
m_phraseDictionaryQueue.push_back(&node);
|
||||
}
|
||||
for (size_t startPos = 0; startPos < size - phaseSize + 1; ++startPos) {
|
||||
size_t endPos = startPos + phaseSize -1;
|
||||
//cerr << startPos << "-" << endPos << "=" << GetPhrase(startPos, endPos) << endl;
|
||||
InputLatticeNode &node = GetInputLatticeNode(startPos, endPos);
|
||||
m_phraseDictionaryQueue.push_back(&node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,10 +56,10 @@ public:
|
||||
void CreateTranslationOptions();
|
||||
|
||||
void CreateTranslationOptionsForRange(const DecodeGraph &decodeStepList
|
||||
, size_t startPosition
|
||||
, size_t endPosition
|
||||
, bool adhereTableLimit
|
||||
, size_t graphInd);
|
||||
, size_t startPosition
|
||||
, size_t endPosition
|
||||
, bool adhereTableLimit
|
||||
, size_t graphInd);
|
||||
|
||||
};
|
||||
|
||||
|
@ -5,7 +5,7 @@ use File::Basename;
|
||||
|
||||
sub Beautify($);
|
||||
|
||||
Beautify("/home/hieu/workspace/github/mosesdecoder");
|
||||
Beautify("/home/hieu/workspace/github/hh");
|
||||
|
||||
sub Beautify($)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user