WordsRange -> Range

This commit is contained in:
Hieu Hoang 2015-10-25 13:37:59 +00:00
parent 84b1c4b4c0
commit 97b2aa5663
139 changed files with 376 additions and 376 deletions

View File

@ -1146,14 +1146,14 @@
<locationURI>PARENT-3-PROJECT_LOC/moses/Bitmap.h</locationURI>
</link>
<link>
<name>WordsRange.cpp</name>
<name>Range.cpp</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/WordsRange.cpp</locationURI>
<locationURI>PARENT-3-PROJECT_LOC/moses/Range.cpp</locationURI>
</link>
<link>
<name>WordsRange.h</name>
<name>Range.h</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/WordsRange.h</locationURI>
<locationURI>PARENT-3-PROJECT_LOC/moses/Range.h</locationURI>
</link>
<link>
<name>XmlOption.cpp</name>
@ -4956,9 +4956,9 @@
<locationURI>PARENT-3-PROJECT_LOC/moses/bin/gcc-4.8/release/debug-symbols-on/link-static/threading-multi/Bitmap.o</locationURI>
</link>
<link>
<name>bin/gcc-4.8/release/debug-symbols-on/link-static/threading-multi/WordsRange.o</name>
<name>bin/gcc-4.8/release/debug-symbols-on/link-static/threading-multi/Range.o</name>
<type>1</type>
<locationURI>PARENT-3-PROJECT_LOC/moses/bin/gcc-4.8/release/debug-symbols-on/link-static/threading-multi/WordsRange.o</locationURI>
<locationURI>PARENT-3-PROJECT_LOC/moses/bin/gcc-4.8/release/debug-symbols-on/link-static/threading-multi/Range.o</locationURI>
</link>
<link>
<name>bin/gcc-4.8/release/debug-symbols-on/link-static/threading-multi/XmlOption.o</name>

View File

@ -771,8 +771,8 @@
<File Name="../../../moses/WordLattice.h"/>
<File Name="../../../moses/Bitmap.cpp"/>
<File Name="../../../moses/Bitmap.h"/>
<File Name="../../../moses/WordsRange.cpp"/>
<File Name="../../../moses/WordsRange.h"/>
<File Name="../../../moses/Range.cpp"/>
<File Name="../../../moses/Range.h"/>
<File Name="../../../moses/XmlOption.cpp"/>
<File Name="../../../moses/XmlOption.h"/>
<File Name="../../../moses/OutputFileStream.cpp"/>

View File

@ -22,7 +22,7 @@ protected:
BaseManager(ttasksptr const& ttask);
// output
typedef std::vector<std::pair<Moses::Word, Moses::WordsRange> > ApplicationContext;
typedef std::vector<std::pair<Moses::Word, Moses::Range> > ApplicationContext;
typedef std::set< std::pair<size_t, size_t> > Alignments;
void OutputSurface(std::ostream &out,

View File

@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include <cmath>
#include <cstdlib>
#include "TypeDef.h"
#include "WordsRange.h"
#include "Range.h"
namespace Moses
{
@ -162,7 +162,7 @@ public:
}
void
SetValue(WordsRange const& range, bool val) {
SetValue(Range const& range, bool val) {
SetValue(range.GetStartPos(), range.GetEndPos(), val);
}
@ -171,7 +171,7 @@ public:
return GetSize() == GetNumWordsCovered();
}
//! whether the wordrange overlaps with any translated word in this bitmap
bool Overlap(const WordsRange &compare) const {
bool Overlap(const Range &compare) const {
for (size_t pos = compare.GetStartPos() ; pos <= compare.GetEndPos() ; pos++) {
if (m_bitmap[pos])
return true;

View File

@ -52,7 +52,7 @@ public:
class HypothesisScoreOrdererWithDistortion
{
public:
HypothesisScoreOrdererWithDistortion(const WordsRange* transOptRange) :
HypothesisScoreOrdererWithDistortion(const Range* transOptRange) :
m_transOptRange(transOptRange) {
m_totalWeightDistortion = 0;
const StaticData &staticData = StaticData::Instance();
@ -67,7 +67,7 @@ public:
}
}
const WordsRange* m_transOptRange;
const Range* m_transOptRange;
float m_totalWeightDistortion;
bool operator()(const Hypothesis* hypoA, const Hypothesis* hypoB) const {
@ -136,7 +136,7 @@ BackwardsEdge::BackwardsEdge(const BitmapContainer &prevBitmapContainer
return;
}
const WordsRange &transOptRange = translations.Get(0)->GetSourceWordsRange();
const Range &transOptRange = translations.Get(0)->GetSourceWordsRange();
HypothesisSet::const_iterator iterHypo = m_prevBitmapContainer.GetHypotheses().begin();
HypothesisSet::const_iterator iterEnd = m_prevBitmapContainer.GetHypotheses().end();
@ -196,7 +196,7 @@ BackwardsEdge::Initialize()
}
const Bitmap &bm = m_hypotheses[0]->GetWordsBitmap();
const WordsRange &newRange = m_translations.Get(0)->GetSourceWordsRange();
const Range &newRange = m_translations.Get(0)->GetSourceWordsRange();
m_futureScore = m_futureScores.CalcFutureScore2(bm, newRange.GetStartPos(), newRange.GetEndPos());
Hypothesis *expanded = CreateHypothesis(*m_hypotheses[0], *m_translations.Get(0));

View File

@ -20,7 +20,7 @@ Bitmaps::~Bitmaps()
}
}
const Bitmap &Bitmaps::GetNextBitmap(const Bitmap &bm, const WordsRange &range)
const Bitmap &Bitmaps::GetNextBitmap(const Bitmap &bm, const Range &range)
{
Bitmap *newBM = new Bitmap(bm);
newBM->SetValue(range, true);
@ -35,7 +35,7 @@ const Bitmap &Bitmaps::GetNextBitmap(const Bitmap &bm, const WordsRange &range)
}
}
const Bitmap &Bitmaps::GetBitmap(const Bitmap &bm, const WordsRange &range)
const Bitmap &Bitmaps::GetBitmap(const Bitmap &bm, const Range &range)
{
Coll::iterator iter = m_coll.find(&bm);
assert(iter != m_coll.end());

View File

@ -11,13 +11,13 @@ namespace Moses
class Bitmaps
{
typedef boost::unordered_map<WordsRange, const Bitmap*> NextBitmaps;
typedef boost::unordered_map<Range, const Bitmap*> NextBitmaps;
typedef boost::unordered_map<const Bitmap*, NextBitmaps, UnorderedComparer<Bitmap>, UnorderedComparer<Bitmap> > Coll;
//typedef std::set<const Bitmap*, OrderedComparer<Bitmap> > Coll;
Coll m_coll;
const Bitmap *m_initBitmap;
const Bitmap &GetNextBitmap(const Bitmap &bm, const WordsRange &range);
const Bitmap &GetNextBitmap(const Bitmap &bm, const Range &range);
public:
Bitmaps(size_t inputSize, const std::vector<bool> &initSourceCompleted);
virtual ~Bitmaps();
@ -25,7 +25,7 @@ public:
const Bitmap &GetInitialBitmap() const {
return *m_initBitmap;
}
const Bitmap &GetBitmap(const Bitmap &bm, const WordsRange &range);
const Bitmap &GetBitmap(const Bitmap &bm, const Range &range);
};

View File

@ -25,7 +25,7 @@
#include "HypergraphOutput.h"
#include "RuleCubeQueue.h"
#include "RuleCube.h"
#include "WordsRange.h"
#include "Range.h"
#include "Util.h"
#include "StaticData.h"
#include "ChartTranslationOptions.h"

View File

@ -26,7 +26,7 @@
#include <map>
#include <vector>
#include "Word.h"
#include "WordsRange.h"
#include "Range.h"
#include "NonTerminal.h"
#include "ChartHypothesis.h"
#include "ChartHypothesisCollection.h"
@ -60,12 +60,12 @@ public:
return m_targetLabelSet;
}
const WordsRange &GetCoverage() const {
const Range &GetCoverage() const {
return m_coverage;
}
protected:
const WordsRange m_coverage;
const Range m_coverage;
ChartCellLabelSet m_targetLabelSet;
};

View File

@ -21,7 +21,7 @@
#include "ChartCellCollection.h"
#include "InputType.h"
#include "WordsRange.h"
#include "Range.h"
#include "ChartManager.h"
namespace Moses

View File

@ -23,7 +23,7 @@
#include <boost/ptr_container/ptr_vector.hpp>
#include "InputType.h"
#include "ChartCell.h"
#include "WordsRange.h"
#include "Range.h"
#include "InputPath.h"
namespace Moses
@ -51,7 +51,7 @@ public:
* gets it from there :-(. The span is actually stored as a reference,
* which needs to point somewhere, so I have it refer to the ChartCell.
*/
const WordsRange &range = inner[0]->GetCoverage();
const Range &range = inner[0]->GetCoverage();
m_source.push_back(new ChartCellLabel(range, input.GetWord(startPos)));
}
@ -60,11 +60,11 @@ public:
virtual ~ChartCellCollectionBase();
const ChartCellBase &GetBase(const WordsRange &coverage) const {
const ChartCellBase &GetBase(const Range &coverage) const {
return *m_cells[coverage.GetStartPos()][coverage.GetEndPos() - coverage.GetStartPos()];
}
ChartCellBase &MutableBase(const WordsRange &coverage) {
ChartCellBase &MutableBase(const Range &coverage) {
return *m_cells[coverage.GetStartPos()][coverage.GetEndPos() - coverage.GetStartPos()];
}
@ -88,12 +88,12 @@ public:
ChartCellCollection(const InputType &input, ChartManager &manager);
//! get a chart cell for a particular range
ChartCell &Get(const WordsRange &coverage) {
ChartCell &Get(const Range &coverage) {
return static_cast<ChartCell&>(MutableBase(coverage));
}
//! get a chart cell for a particular range
const ChartCell &Get(const WordsRange &coverage) const {
const ChartCell &Get(const Range &coverage) const {
return static_cast<const ChartCell&>(GetBase(coverage));
}
};

View File

@ -21,7 +21,7 @@
#include "HypoList.h"
#include "Word.h"
#include "WordsRange.h"
#include "Range.h"
#include "ChartParserCallback.h"
namespace search
@ -49,7 +49,7 @@ public:
};
ChartCellLabel(const WordsRange &coverage, const Word &label,
ChartCellLabel(const Range &coverage, const Word &label,
Stack stack=Stack())
: m_coverage(coverage)
, m_label(label)
@ -57,7 +57,7 @@ public:
, m_bestScore(0) {
}
const WordsRange &GetCoverage() const {
const Range &GetCoverage() const {
return m_coverage;
}
const Word &GetLabel() const {
@ -79,7 +79,7 @@ public:
}
private:
const WordsRange &m_coverage;
const Range &m_coverage;
const Word &m_label;
//const InputPath &m_inputPath;
Stack m_stack;

View File

@ -44,7 +44,7 @@ public:
typedef MapType::const_iterator const_iterator;
typedef MapType::iterator iterator;
ChartCellLabelSet(const WordsRange &coverage)
ChartCellLabelSet(const Range &coverage)
: m_coverage(coverage)
, m_map(FactorCollection::Instance().GetNumNonTerminals(), NULL)
, m_size(0) { }
@ -139,7 +139,7 @@ public:
}
private:
const WordsRange &m_coverage;
const Range &m_coverage;
MapType m_map;
size_t m_size;
};

View File

@ -23,7 +23,7 @@
#include <vector>
#include <boost/scoped_ptr.hpp>
#include "Util.h"
#include "WordsRange.h"
#include "Range.h"
#include "ScoreComponentCollection.h"
#include "Phrase.h"
#include "ChartTranslationOptions.h"
@ -52,7 +52,7 @@ protected:
boost::shared_ptr<ChartTranslationOption> m_transOpt;
WordsRange m_currSourceWordsRange;
Range m_currSourceWordsRange;
std::vector<const FFState*> m_ffStates; /*! stateful feature function states */
/*! sum of scores of this hypothesis, and previous hypotheses. Lazily initialised. */
mutable boost::scoped_ptr<ScoreComponentCollection> m_scoreBreakdown;
@ -100,7 +100,7 @@ public:
}
//! the source range that this hypothesis spans
const WordsRange &GetCurrSourceRange() const {
const Range &GetCurrSourceRange() const {
return m_currSourceWordsRange;
}

View File

@ -82,7 +82,7 @@ void ChartManager::Decode()
for (int startPos = size-1; startPos >= 0; --startPos) {
for (size_t width = 1; width <= size-startPos; ++width) {
size_t endPos = startPos + width - 1;
WordsRange range(startPos, endPos);
Range range(startPos, endPos);
// create trans opt
m_translationOptionList.Clear();
@ -115,7 +115,7 @@ void ChartManager::Decode()
cerr << " ";
}
for (size_t startPos = 0; startPos <= size-width; ++startPos) {
WordsRange range(startPos, startPos+width-1);
Range range(startPos, startPos+width-1);
cerr.width(3);
cerr << m_hypoStackColl.Get(range).GetSize() << " ";
}
@ -142,7 +142,7 @@ void ChartManager::AddXmlChartOptions()
i != xmlChartOptionsList.end(); ++i) {
ChartTranslationOptions* opt = *i;
const WordsRange &range = opt->GetSourceWordsRange();
const Range &range = opt->GetSourceWordsRange();
RuleCubeItem* item = new RuleCubeItem( *opt, m_hypoStackColl );
ChartHypothesis* hypo = new ChartHypothesis(*opt, *item, *this);
@ -162,7 +162,7 @@ const ChartHypothesis *ChartManager::GetBestHypothesis() const
if (size == 0) // empty source
return NULL;
else {
WordsRange range(0, size-1);
Range range(0, size-1);
const ChartCell &lastCell = m_hypoStackColl.Get(range);
return lastCell.GetBestHypothesis();
}
@ -185,7 +185,7 @@ void ChartManager::CalcNBest(
}
// Get the list of top-level hypotheses, sorted by score.
WordsRange range(0, m_source.GetSize()-1);
Range range(0, m_source.GetSize()-1);
const ChartCell &lastCell = m_hypoStackColl.Get(range);
boost::scoped_ptr<const std::vector<const ChartHypothesis*> > topLevelHypos(
lastCell.GetAllSortedHypotheses());
@ -234,7 +234,7 @@ void ChartManager::WriteSearchGraph(const ChartSearchGraphWriter& writer) const
// which hypotheses are reachable?
std::map<unsigned,bool> reachable;
WordsRange fullRange(0, size-1);
Range fullRange(0, size-1);
const ChartCell &lastCell = m_hypoStackColl.Get(fullRange);
const ChartHypothesis *hypo = lastCell.GetBestHypothesis();
@ -251,7 +251,7 @@ void ChartManager::WriteSearchGraph(const ChartSearchGraphWriter& writer) const
for (size_t width = 1; width <= size; ++width) {
for (size_t startPos = 0; startPos <= size-width; ++startPos) {
size_t endPos = startPos + width - 1;
WordsRange range(startPos, endPos);
Range range(startPos, endPos);
TRACE_ERR(" " << range << "=");
const ChartCell &cell = m_hypoStackColl.Get(range);
@ -674,18 +674,18 @@ void ChartManager::ReconstructApplicationContext(const ChartHypothesis &hypo,
const std::vector<const ChartHypothesis*> &prevHypos = hypo.GetPrevHypos();
std::vector<const ChartHypothesis*>::const_iterator p = prevHypos.begin();
std::vector<const ChartHypothesis*>::const_iterator end = prevHypos.end();
const WordsRange &span = hypo.GetCurrSourceRange();
const Range &span = hypo.GetCurrSourceRange();
size_t i = span.GetStartPos();
while (i <= span.GetEndPos()) {
if (p == end || i < (*p)->GetCurrSourceRange().GetStartPos()) {
// Symbol is a terminal.
const Word &symbol = sentence.GetWord(i);
context.push_back(std::make_pair(symbol, WordsRange(i, i)));
context.push_back(std::make_pair(symbol, Range(i, i)));
++i;
} else {
// Symbol is a non-terminal.
const Word &symbol = (*p)->GetTargetLHS();
const WordsRange &range = (*p)->GetCurrSourceRange();
const Range &range = (*p)->GetCurrSourceRange();
context.push_back(std::make_pair(symbol, range));
i = range.GetEndPos()+1;
++p;
@ -797,7 +797,7 @@ void ChartManager::OutputDetailedAllTranslationReport(
for (size_t width = 1; width <= size; ++width) {
for (size_t startPos = 0; startPos <= size-width; ++startPos) {
size_t endPos = startPos + width - 1;
WordsRange range(startPos, endPos);
Range range(startPos, endPos);
const ChartCell& cell = cells.Get(range);
const HypoList* hyps = cell.GetAllSortedHypotheses();
out << "Chart Cell [" << startPos << ".." << endPos << "]" << endl;

View File

@ -25,7 +25,7 @@
#include <boost/unordered_map.hpp>
#include "ChartCell.h"
#include "ChartCellCollection.h"
#include "WordsRange.h"
#include "Range.h"
#include "SentenceStats.h"
#include "ChartTranslationOptionList.h"
#include "ChartParser.h"

View File

@ -47,7 +47,7 @@ ChartParserUnknown::~ChartParserUnknown()
// RemoveAllInColl(m_cacheTargetPhraseCollection);
}
void ChartParserUnknown::Process(const Word &sourceWord, const WordsRange &range, ChartParserCallback &to)
void ChartParserUnknown::Process(const Word &sourceWord, const Range &range, ChartParserCallback &to)
{
// unknown word, add as trans opt
const StaticData &staticData = StaticData::Instance();
@ -183,7 +183,7 @@ ChartParser::~ChartParser()
}
}
void ChartParser::Create(const WordsRange &wordsRange, ChartParserCallback &to)
void ChartParser::Create(const Range &range, ChartParserCallback &to)
{
assert(m_decodeGraphList.size() == m_ruleLookupManagers.size());
@ -196,20 +196,20 @@ void ChartParser::Create(const WordsRange &wordsRange, ChartParserCallback &to)
size_t maxSpan = decodeGraph.GetMaxChartSpan();
size_t last = m_source.GetSize()-1;
if (maxSpan != 0) {
last = min(last, wordsRange.GetStartPos()+maxSpan);
last = min(last, range.GetStartPos()+maxSpan);
}
if (maxSpan == 0 || wordsRange.GetNumWordsCovered() <= maxSpan) {
const InputPath &inputPath = GetInputPath(wordsRange);
if (maxSpan == 0 || range.GetNumWordsCovered() <= maxSpan) {
const InputPath &inputPath = GetInputPath(range);
ruleLookupManager.GetChartRuleCollection(inputPath, last, to);
}
}
if (wordsRange.GetNumWordsCovered() == 1 && wordsRange.GetStartPos() != 0 && wordsRange.GetStartPos() != m_source.GetSize()-1) {
if (range.GetNumWordsCovered() == 1 && range.GetStartPos() != 0 && range.GetStartPos() != m_source.GetSize()-1) {
bool alwaysCreateDirectTranslationOption = StaticData::Instance().IsAlwaysCreateDirectTranslationOption();
if (to.Empty() || alwaysCreateDirectTranslationOption) {
// create unknown words for 1 word coverage where we don't have any trans options
const Word &sourceWord = m_source.GetWord(wordsRange.GetStartPos());
m_unknown.Process(sourceWord, wordsRange, to);
const Word &sourceWord = m_source.GetWord(range.GetStartPos());
m_unknown.Process(sourceWord, range, to);
}
}
}
@ -226,8 +226,8 @@ void ChartParser::CreateInputPaths(const InputType &input)
size_t endPos = startPos + phaseSize -1;
vector<InputPath*> &vec = m_inputPathMatrix[startPos];
WordsRange range(startPos, endPos);
Phrase subphrase(input.GetSubString(WordsRange(startPos, endPos)));
Range range(startPos, endPos);
Phrase subphrase(input.GetSubString(Range(startPos, endPos)));
const NonTerminalSet &labels = input.GetLabelSet(startPos, endPos);
InputPath *node;
@ -245,7 +245,7 @@ void ChartParser::CreateInputPaths(const InputType &input)
}
}
const InputPath &ChartParser::GetInputPath(const WordsRange &range) const
const InputPath &ChartParser::GetInputPath(const Range &range) const
{
return GetInputPath(range.GetStartPos(), range.GetEndPos());
}

View File

@ -24,7 +24,7 @@
#include <list>
#include <vector>
#include "WordsRange.h"
#include "Range.h"
#include "StackVec.h"
#include "InputPath.h"
#include "TargetPhraseCollection.h"
@ -48,7 +48,7 @@ public:
ChartParserUnknown(ttasksptr const& ttask);
~ChartParserUnknown();
void Process(const Word &sourceWord, const WordsRange &range, ChartParserCallback &to);
void Process(const Word &sourceWord, const Range &range, ChartParserCallback &to);
const std::vector<Phrase*> &GetUnknownSources() const {
return m_unksrcs;
@ -66,14 +66,14 @@ public:
ChartParser(ttasksptr const& ttask, ChartCellCollectionBase &cells);
~ChartParser();
void Create(const WordsRange &range, ChartParserCallback &to);
void Create(const Range &range, ChartParserCallback &to);
//! the sentence being decoded
//const Sentence &GetSentence() const;
long GetTranslationId() const;
size_t GetSize() const;
const InputPath &GetInputPath(size_t startPos, size_t endPos) const;
const InputPath &GetInputPath(const WordsRange &range) const;
const InputPath &GetInputPath(const Range &range) const;
const std::vector<Phrase*> &GetUnknownSources() const {
return m_unknown.GetUnknownSources();
}

View File

@ -9,7 +9,7 @@ namespace Moses
{
class TargetPhraseCollection;
class WordsRange;
class Range;
class TargetPhrase;
class InputPath;
class InputType;
@ -20,11 +20,11 @@ class ChartParserCallback
public:
virtual ~ChartParserCallback() {}
virtual void Add(const TargetPhraseCollection &, const StackVec &, const WordsRange &) = 0;
virtual void Add(const TargetPhraseCollection &, const StackVec &, const Range &) = 0;
virtual bool Empty() const = 0;
virtual void AddPhraseOOV(TargetPhrase &phrase, std::list<TargetPhraseCollection::shared_ptr > &waste_memory, const WordsRange &range) = 0;
virtual void AddPhraseOOV(TargetPhrase &phrase, std::list<TargetPhraseCollection::shared_ptr > &waste_memory, const Range &range) = 0;
virtual void EvaluateWithSourceContext(const InputType &input, const InputPath &inputPath) = 0;

View File

@ -28,7 +28,7 @@ namespace Moses
{
class ChartParser;
class ChartParserCallback;
class WordsRange;
class Range;
class Sentence;
/** Defines an interface for looking up rules in a rule table. Concrete
@ -48,7 +48,7 @@ public:
virtual ~ChartRuleLookupManager();
const ChartCellLabelSet &GetTargetLabelSet(size_t begin, size_t end) const {
return m_cellCollection.GetBase(WordsRange(begin, end)).GetTargetLabelSet();
return m_cellCollection.GetBase(Range(begin, end)).GetTargetLabelSet();
}
const ChartParser &GetParser() const {

View File

@ -24,7 +24,7 @@
#include "ChartTranslationOptionList.h"
#include "ChartTranslationOptions.h"
#include "ChartCellCollection.h"
#include "WordsRange.h"
#include "Range.h"
#include "InputType.h"
#include "InputPath.h"
@ -61,7 +61,7 @@ public:
void ChartTranslationOptionList::Add(const TargetPhraseCollection &tpc,
const StackVec &stackVec,
const WordsRange &range)
const Range &range)
{
if (tpc.IsEmpty()) {
return;
@ -119,7 +119,7 @@ void
ChartTranslationOptionList::
AddPhraseOOV(TargetPhrase &phrase,
std::list<TargetPhraseCollection::shared_ptr > &waste_memory,
const WordsRange &range)
const Range &range)
{
TargetPhraseCollection::shared_ptr tpc(new TargetPhraseCollection);
tpc->Add(&phrase);

View File

@ -29,7 +29,7 @@ namespace Moses
{
class TargetPhraseCollection;
class WordsRange;
class Range;
class InputType;
class InputPath;
class ChartCellLabel;
@ -53,9 +53,9 @@ public:
}
void Add(const TargetPhraseCollection &, const StackVec &,
const WordsRange &);
const Range &);
void AddPhraseOOV(TargetPhrase &phrase, std::list<TargetPhraseCollection::shared_ptr > &waste_memory, const WordsRange &range);
void AddPhraseOOV(TargetPhrase &phrase, std::list<TargetPhraseCollection::shared_ptr > &waste_memory, const Range &range);
bool Empty() const {
return m_size == 0;

View File

@ -31,10 +31,10 @@ namespace Moses
ChartTranslationOptions::ChartTranslationOptions(const TargetPhraseCollection &targetPhraseColl,
const StackVec &stackVec,
const WordsRange &wordsRange,
const Range &range,
float score)
: m_stackVec(stackVec)
, m_wordsRange(&wordsRange)
, m_wordsRange(&range)
, m_estimateOfBestScore(score)
{
TargetPhraseCollection::const_iterator iter;

View File

@ -22,7 +22,7 @@
#include "StackVec.h"
#include "TargetPhrase.h"
#include "TargetPhraseCollection.h"
#include "WordsRange.h"
#include "Range.h"
#include <vector>
#include <boost/shared_ptr.hpp>
@ -47,12 +47,12 @@ public:
/** Constructor
\param targetPhraseColl @todo dunno
\param stackVec @todo dunno
\param wordsRange the range in the source sentence this translation option covers
\param range the range in the source sentence this translation option covers
\param score @todo dunno
*/
ChartTranslationOptions(const TargetPhraseCollection &targetPhraseColl,
const StackVec &stackVec,
const WordsRange &wordsRange,
const Range &range,
float score);
~ChartTranslationOptions();
@ -74,7 +74,7 @@ public:
}
//! the range in the source sentence this translation option covers
const WordsRange &GetSourceWordsRange() const {
const Range &GetSourceWordsRange() const {
return *m_wordsRange;
}
@ -97,7 +97,7 @@ private:
StackVec m_stackVec; //! vector of hypothesis list!
CollType m_collection;
const WordsRange *m_wordsRange;
const Range *m_wordsRange;
float m_estimateOfBestScore;
};

View File

@ -261,7 +261,7 @@ void ConfusionNet::Print(std::ostream& out) const
#endif
Phrase
ConfusionNet::
GetSubString(const WordsRange&) const
GetSubString(const Range&) const
{
UTIL_THROW2("ERROR: call to ConfusionNet::GetSubString\n");
//return Phrase(Input);

View File

@ -69,7 +69,7 @@ public:
int Read(std::istream& in,const std::vector<FactorType>& factorOrder);
Phrase GetSubString(const WordsRange&) const; //TODO not defined
Phrase GetSubString(const Range&) const; //TODO not defined
std::string GetStringRep(const std::vector<FactorType> factorsToPrint) const; //TODO not defined
const Word& GetWord(size_t pos) const;

View File

@ -150,7 +150,7 @@ void DecodeStepGeneration::Process(const TranslationOption &inputPartialTranslOp
outPhrase.MergeFactors(genPhrase, m_newOutputFactors);
outPhrase.EvaluateInIsolation(inputPath.GetPhrase(), m_featuresToApply);
const WordsRange &sourceWordsRange = inputPartialTranslOpt.GetSourceWordsRange();
const Range &sourceWordsRange = inputPartialTranslOpt.GetSourceWordsRange();
TranslationOption *newTransOpt = new TranslationOption(sourceWordsRange, outPhrase);
assert(newTransOpt);

View File

@ -58,7 +58,7 @@ void DecodeStepTranslation::Process(const TranslationOption &inputPartialTranslO
}
// normal trans step
const WordsRange &sourceWordsRange = inputPartialTranslOpt.GetSourceWordsRange();
const Range &sourceWordsRange = inputPartialTranslOpt.GetSourceWordsRange();
const InputPath &inputPath = inputPartialTranslOpt.GetInputPath();
const PhraseDictionary* phraseDictionary =
decodeStep.GetPhraseDictionaryFeature();
@ -110,12 +110,12 @@ void DecodeStepTranslation::ProcessInitialTranslation(
const PhraseDictionary* phraseDictionary = GetPhraseDictionaryFeature();
const size_t tableLimit = phraseDictionary->GetTableLimit();
const WordsRange wordsRange(startPos, endPos);
const Range range(startPos, endPos);
if (phraseColl != NULL) {
IFVERBOSE(3) {
if(StaticData::Instance().GetInputType() == SentenceInput)
TRACE_ERR("[" << source.GetSubString(wordsRange) << "; " << startPos << "-" << endPos << "]\n");
TRACE_ERR("[" << source.GetSubString(range) << "; " << startPos << "-" << endPos << "]\n");
else
TRACE_ERR("[" << startPos << "-" << endPos << "]" << std::endl);
}
@ -125,7 +125,7 @@ void DecodeStepTranslation::ProcessInitialTranslation(
for (iterTargetPhrase = phraseColl->begin() ; iterTargetPhrase != iterEnd ; ++iterTargetPhrase) {
const TargetPhrase &targetPhrase = **iterTargetPhrase;
TranslationOption *transOpt = new TranslationOption(wordsRange, targetPhrase);
TranslationOption *transOpt = new TranslationOption(range, targetPhrase);
transOpt->SetInputPath(inputPath);
@ -146,14 +146,14 @@ void DecodeStepTranslation::ProcessInitialTranslationLEGACY(
const PhraseDictionary* phraseDictionary = GetPhraseDictionaryFeature();
const size_t tableLimit = phraseDictionary->GetTableLimit();
const WordsRange wordsRange(startPos, endPos);
const Range range(startPos, endPos);
TargetPhraseCollectionWithSourcePhrase::shared_ptr phraseColl
= phraseDictionary->GetTargetPhraseCollectionLEGACY(source,wordsRange);
= phraseDictionary->GetTargetPhraseCollectionLEGACY(source,range);
if (phraseColl != NULL) {
IFVERBOSE(3) {
if(StaticData::Instance().GetInputType() == SentenceInput)
TRACE_ERR("[" << source.GetSubString(wordsRange) << "; " << startPos << "-" << endPos << "]\n");
TRACE_ERR("[" << source.GetSubString(range) << "; " << startPos << "-" << endPos << "]\n");
else
TRACE_ERR("[" << startPos << "-" << endPos << "]" << std::endl);
}
@ -174,7 +174,7 @@ void DecodeStepTranslation::ProcessInitialTranslationLEGACY(
const InputPath &inputPath = GetInputPathLEGACY(targetPhrase, sourcePhrase, inputPathList);
TranslationOption *transOpt = new TranslationOption(wordsRange, targetPhrase);
TranslationOption *transOpt = new TranslationOption(range, targetPhrase);
transOpt->SetInputPath(inputPath);
outputPartialTranslOptColl.Add (transOpt);
@ -206,7 +206,7 @@ const InputPath &DecodeStepTranslation::GetInputPathLEGACY(
}
}
// const WordsRange &range = inputPath.GetWordsRange();
// const Range &range = inputPath.GetWordsRange();
if (wordIP && *wordIP == wordFromPt) {
return inputPath;
@ -231,7 +231,7 @@ ProcessLEGACY(TranslationOption const& in,
}
// normal trans step
WordsRange const& srcRange = in.GetSourceWordsRange();
Range const& srcRange = in.GetSourceWordsRange();
InputPath const& inputPath = in.GetInputPath();
PhraseDictionary const* pdict = decodeStep.GetPhraseDictionaryFeature();
TargetPhrase const& inPhrase = in.GetTargetPhrase();

View File

@ -380,7 +380,7 @@ void BleuScoreFeature::GetNgramMatchCounts(Phrase& phrase,
ngram_end_idx = end_idx;
ngram_start_idx = end_idx - order;
Phrase ngram = phrase.GetSubString(WordsRange(ngram_start_idx, ngram_end_idx), 0);
Phrase ngram = phrase.GetSubString(Range(ngram_start_idx, ngram_end_idx), 0);
ret_counts[order]++;
ref_ngram_counts_iter = ref_ngram_counts.find(ngram);
@ -409,7 +409,7 @@ void BleuScoreFeature::GetNgramMatchCounts_prefix(Phrase& phrase,
if (order > ngram_end_idx) break;
if (ngram_end_idx > last_end_index) break;
Phrase ngram = phrase.GetSubString(WordsRange(ngram_start_idx, ngram_end_idx), 0);
Phrase ngram = phrase.GetSubString(Range(ngram_start_idx, ngram_end_idx), 0);
ret_counts[order]++;
ref_ngram_counts_iter = ref_ngram_counts.find(ngram);
@ -439,7 +439,7 @@ void BleuScoreFeature::GetNgramMatchCounts_overlap(Phrase& phrase,
ngram_start_idx = end_idx - order;
if (ngram_start_idx >= overlap_index) continue; // only score ngrams that span the overlap point
Phrase ngram = phrase.GetSubString(WordsRange(ngram_start_idx, ngram_end_idx), 0);
Phrase ngram = phrase.GetSubString(Range(ngram_start_idx, ngram_end_idx), 0);
ret_counts[order]++;
ref_ngram_counts_iter = ref_ngram_counts.find(ngram);
@ -466,7 +466,7 @@ void BleuScoreFeature::GetClippedNgramMatchesAndCounts(Phrase& phrase,
ngram_end_idx = end_idx;
ngram_start_idx = end_idx - order;
Phrase ngram = phrase.GetSubString(WordsRange(ngram_start_idx, ngram_end_idx), 0);
Phrase ngram = phrase.GetSubString(Range(ngram_start_idx, ngram_end_idx), 0);
ret_counts[order]++;
ref_ngram_counts_iter = ref_ngram_counts.find(ngram);
@ -541,7 +541,7 @@ FFState* BleuScoreFeature::EvaluateWhenApplied(const Hypothesis& cur_hypo,
Bitmap coverageVector = cur_hypo.GetWordsBitmap();
new_state->m_source_length = coverageVector.GetNumWordsCovered();
new_state->m_words = new_words.GetSubString(WordsRange(ctx_start_idx,
new_state->m_words = new_words.GetSubString(Range(ctx_start_idx,
ctx_end_idx));
new_state->m_target_length += cur_hypo.GetCurrTargetLength();
@ -672,7 +672,7 @@ FFState* BleuScoreFeature::EvaluateWhenApplied(const ChartHypothesis& cur_hypo,
}
new_state->m_source_length = cur_hypo.GetCurrSourceRange().GetNumWordsCovered();
new_state->m_words = new_words.GetSubString(WordsRange(ctx_start_idx, ctx_end_idx));
new_state->m_words = new_words.GetSubString(Range(ctx_start_idx, ctx_end_idx));
new_state->m_target_length = cur_hypo.GetOutputPhrase().GetSize();
// we need a scaled reference length to compare the current target phrase to the corresponding
@ -699,7 +699,7 @@ float BleuScoreFeature::CalculateBleu(Phrase translation) const
Phrase normTranslation = translation;
// remove start and end symbol for chart decoding
if (m_cur_source_length != m_cur_norm_source_length) {
WordsRange* range = new WordsRange(1, translation.GetSize()-2);
Range* range = new Range(1, translation.GetSize()-2);
normTranslation = translation.GetSubString(*range);
}

View File

@ -1,7 +1,7 @@
#include "DistortionScoreProducer.h"
#include "FFState.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/StaticData.h"
#include "moses/Hypothesis.h"
@ -10,9 +10,9 @@ using namespace std;
namespace Moses
{
struct DistortionState_traditional : public FFState {
WordsRange range;
Range range;
int first_gap;
DistortionState_traditional(const WordsRange& wr, int fg) : range(wr), first_gap(fg) {}
DistortionState_traditional(const Range& wr, int fg) : range(wr), first_gap(fg) {}
size_t hash() const {
return range.GetEndPos();
@ -45,12 +45,12 @@ const FFState* DistortionScoreProducer::EmptyHypothesisState(const InputType &in
end = input.m_frontSpanCoveredLength -1;
}
return new DistortionState_traditional(
WordsRange(start, end),
Range(start, end),
NOT_FOUND);
}
float DistortionScoreProducer::CalculateDistortionScore(const Hypothesis& hypo,
const WordsRange &prev, const WordsRange &curr, const int FirstGap)
const Range &prev, const Range &curr, const int FirstGap)
{
if(!StaticData::Instance().UseEarlyDistortionCost()) {
return - (float) hypo.GetInput().ComputeDistortionDistance(prev, curr);

View File

@ -10,7 +10,7 @@ class FFState;
class ScoreComponentCollection;
class Hypothesis;
class ChartHypothesis;
class WordsRange;
class Range;
/** Calculates Distortion scores
*/
@ -31,7 +31,7 @@ public:
}
static float CalculateDistortionScore(const Hypothesis& hypo,
const WordsRange &prev, const WordsRange &curr, const int FirstGapPosition);
const Range &prev, const Range &curr, const int FirstGapPosition);
virtual const FFState* EmptyHypothesisState(const InputType &input) const;

View File

@ -31,7 +31,7 @@ typedef std::map<std::string, decaying_cache_value_t > decaying_cache_t;
namespace Moses
{
class WordsRange;
class Range;
/** Calculates score for the Dynamic Cache-Based pseudo LM
*/

View File

@ -22,7 +22,7 @@ class ChartHypothesis;
class InputType;
class ScoreComponentCollection;
class Bitmap;
class WordsRange;
class Range;
class FactorMask;
class InputPath;
class StackVec;

View File

@ -10,7 +10,7 @@
#include "moses/Phrase.h"
#include "moses/TypeDef.h"
#include "moses/Util.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/FactorTypeSet.h"
#include "moses/Sentence.h"

View File

@ -12,7 +12,7 @@
#include "moses/Phrase.h"
#include "moses/TypeDef.h"
#include "moses/Util.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/FactorTypeSet.h"
#include "moses/Sentence.h"

View File

@ -8,7 +8,7 @@
#include "moses/Phrase.h"
#include "moses/TypeDef.h"
#include "moses/Util.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/TranslationOption.h"
#include "moses/FF/StatefulFeatureFunction.h"

View File

@ -4,7 +4,7 @@
#include "moses/FF/FFState.h"
#include "moses/Hypothesis.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/TranslationOption.h"
#include "moses/Util.h"
@ -16,8 +16,8 @@ namespace Moses
{
bool
IsMonotonicStep(WordsRange const& prev, // words range of last source phrase
WordsRange const& cur, // words range of current source phrase
IsMonotonicStep(Range const& prev, // words range of last source phrase
Range const& cur, // words range of current source phrase
Bitmap const& cov) // coverage bitmap
{
size_t e = prev.GetEndPos() + 1;
@ -26,7 +26,7 @@ IsMonotonicStep(WordsRange const& prev, // words range of last source phrase
}
bool
IsSwap(WordsRange const& prev, WordsRange const& cur, Bitmap const& cov)
IsSwap(Range const& prev, Range const& cur, Bitmap const& cov)
{
size_t s = prev.GetStartPos();
size_t e = cur.GetEndPos();
@ -71,7 +71,7 @@ SetAdditionalScoreComponents(size_t number)
/// return orientation for the first phrase
LRModel::ReorderingType
LRModel::
GetOrientation(WordsRange const& cur) const
GetOrientation(Range const& cur) const
{
UTIL_THROW_IF2(m_modelType == None, "Reordering Model Type is None");
return ((m_modelType == LeftRight) ? R :
@ -82,7 +82,7 @@ GetOrientation(WordsRange const& cur) const
LRModel::ReorderingType
LRModel::
GetOrientation(WordsRange const& prev, WordsRange const& cur) const
GetOrientation(Range const& prev, Range const& cur) const
{
UTIL_THROW_IF2(m_modelType == None, "No reordering model type specified");
return ((m_modelType == LeftRight)
@ -110,7 +110,7 @@ GetOrientation(int const reoDistance) const
LRModel::ReorderingType
LRModel::
GetOrientation(WordsRange const& prev, WordsRange const& cur,
GetOrientation(Range const& prev, Range const& cur,
Bitmap const& cov) const
{
return ((m_modelType == LeftRight)
@ -347,7 +347,7 @@ Expand(const TranslationOption& topt, const InputType& input,
if ((m_direction != LRModel::Forward && m_useFirstBackwardScore) || !m_first) {
LRModel const& lrmodel = m_configuration;
WordsRange const cur = topt.GetSourceWordsRange();
Range const cur = topt.GetSourceWordsRange();
LRModel::ReorderingType reoType = (m_first ? lrmodel.GetOrientation(cur)
: lrmodel.GetOrientation(m_prevRange,cur));
CopyScores(scores, topt, input, reoType);
@ -423,7 +423,7 @@ Expand(const TranslationOption& topt, const InputType& input,
{
HReorderingBackwardState* nextState;
nextState = new HReorderingBackwardState(this, topt, m_reoStack);
WordsRange swrange = topt.GetSourceWordsRange();
Range swrange = topt.GetSourceWordsRange();
int reoDistance = nextState->m_reoStack.ShiftReduce(swrange);
ReorderingType reoType = m_configuration.GetOrientation(reoDistance);
CopyScores(scores, topt, input, reoType);
@ -492,7 +492,7 @@ HReorderingForwardState::
Expand(TranslationOption const& topt, InputType const& input,
ScoreComponentCollection* scores) const
{
const WordsRange cur = topt.GetSourceWordsRange();
const Range cur = topt.GetSourceWordsRange();
// keep track of the current coverage ourselves so we don't need the hypothesis
Bitmap cov = m_coverage;
cov.SetValue(cur, true);

View File

@ -7,7 +7,7 @@
#include "moses/Hypothesis.h"
#include "moses/ScoreComponentCollection.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/Bitmap.h"
#include "moses/TranslationOption.h"
#include "moses/FF/FFState.h"
@ -59,13 +59,13 @@ public:
ReorderingType // for first phrase in phrase-based
GetOrientation(WordsRange const& cur) const;
GetOrientation(Range const& cur) const;
ReorderingType // for non-first phrases in phrase-based
GetOrientation(WordsRange const& prev, WordsRange const& cur) const;
GetOrientation(Range const& prev, Range const& cur) const;
ReorderingType // for HReorderingForwardState
GetOrientation(WordsRange const& prev, WordsRange const& cur,
GetOrientation(Range const& prev, Range const& cur,
Bitmap const& cov) const;
ReorderingType // for HReorderingBackwarddState
@ -233,7 +233,7 @@ class PhraseBasedReorderingState
: public LRState
{
private:
WordsRange m_prevRange;
Range m_prevRange;
bool m_first;
public:
static bool m_useFirstBackwardScore;
@ -251,10 +251,10 @@ public:
Expand(const TranslationOption& topt,const InputType& input,
ScoreComponentCollection* scores) const;
ReorderingType GetOrientationTypeMSD(WordsRange currRange) const;
ReorderingType GetOrientationTypeMSLR(WordsRange currRange) const;
ReorderingType GetOrientationTypeMonotonic(WordsRange currRange) const;
ReorderingType GetOrientationTypeLeftRight(WordsRange currRange) const;
ReorderingType GetOrientationTypeMSD(Range currRange) const;
ReorderingType GetOrientationTypeMSLR(Range currRange) const;
ReorderingType GetOrientationTypeMonotonic(Range currRange) const;
ReorderingType GetOrientationTypeLeftRight(Range currRange) const;
};
//! State for a hierarchical reordering model (see Galley and Manning, A
@ -288,7 +288,7 @@ class HReorderingForwardState : public LRState
{
private:
bool m_first;
WordsRange m_prevRange;
Range m_prevRange;
Bitmap m_coverage;
public:

View File

@ -100,7 +100,7 @@ LexicalReorderingTableMemory::GetScore(const Phrase& f,
} else {
//right try from large to smaller context
for(size_t i = 0; i <= c.GetSize(); ++i) {
Phrase sub_c(c.GetSubString(WordsRange(i,c.GetSize()-1)));
Phrase sub_c(c.GetSubString(Range(i,c.GetSize()-1)));
key = MakeKey(f,e,sub_c);
r = m_Table.find(key);
if(m_Table.end() != r) {
@ -582,7 +582,7 @@ Cache(const Sentence& input)
size_t max_phrase_length = input.GetSize();
for(size_t len = 0; len <= max_phrase_length; ++len) {
for(size_t start = 0; start+len <= input.GetSize(); ++start) {
Phrase f = input.GetSubString(WordsRange(start, start+len));
Phrase f = input.GetSubString(Range(start, start+len));
auxCacheForSrcPhrase(f);
}
}

View File

@ -22,7 +22,7 @@ bool ReorderingStack::operator==(const ReorderingStack& o) const
}
// Method to push (shift element into the stack and reduce if reqd)
int ReorderingStack::ShiftReduce(WordsRange input_span)
int ReorderingStack::ShiftReduce(Range input_span)
{
int distance; // value to return: the initial distance between this and previous span
@ -33,7 +33,7 @@ int ReorderingStack::ShiftReduce(WordsRange input_span)
}
// stack is non-empty
WordsRange prev_span = m_stack.back(); //access last element added
Range prev_span = m_stack.back(); //access last element added
//calculate the distance we are returning
if(input_span.GetStartPos() > prev_span.GetStartPos()) {
@ -44,11 +44,11 @@ int ReorderingStack::ShiftReduce(WordsRange input_span)
if(distance == 1) { //monotone
m_stack.pop_back();
WordsRange new_span(prev_span.GetStartPos(), input_span.GetEndPos());
Range new_span(prev_span.GetStartPos(), input_span.GetEndPos());
Reduce(new_span);
} else if(distance == -1) { //swap
m_stack.pop_back();
WordsRange new_span(input_span.GetStartPos(), prev_span.GetEndPos());
Range new_span(input_span.GetStartPos(), prev_span.GetEndPos());
Reduce(new_span);
} else { // discontinuous
m_stack.push_back(input_span);
@ -58,21 +58,21 @@ int ReorderingStack::ShiftReduce(WordsRange input_span)
}
// Method to reduce, if possible the spans
void ReorderingStack::Reduce(WordsRange current)
void ReorderingStack::Reduce(Range current)
{
bool cont_loop = true;
while (cont_loop && m_stack.size() > 0) {
WordsRange previous = m_stack.back();
Range previous = m_stack.back();
if(current.GetStartPos() - previous.GetEndPos() == 1) { //mono&merge
m_stack.pop_back();
WordsRange t(previous.GetStartPos(), current.GetEndPos());
Range t(previous.GetStartPos(), current.GetEndPos());
current = t;
} else if(previous.GetStartPos() - current.GetEndPos() == 1) { //swap&merge
m_stack.pop_back();
WordsRange t(current.GetStartPos(), previous.GetEndPos());
Range t(current.GetStartPos(), previous.GetEndPos());
current = t;
} else { // discontinuous, no more merging
cont_loop=false;

View File

@ -12,7 +12,7 @@
//#include "Phrase.h"
//#include "TypeDef.h"
//#include "Util.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
namespace Moses
{
@ -23,17 +23,17 @@ class ReorderingStack
{
private:
std::vector<WordsRange> m_stack;
std::vector<Range> m_stack;
public:
size_t hash() const;
bool operator==(const ReorderingStack& other) const;
int ShiftReduce(WordsRange input_span);
int ShiftReduce(Range input_span);
private:
void Reduce(WordsRange input_span);
void Reduce(Range input_span);
};

View File

@ -237,9 +237,9 @@ void SparseReordering::CopyScores(
//NB: Using a static cast for speed, but could be nasty if
//using non-sentence input
const Sentence& sentence = static_cast<const Sentence&>(input);
const WordsRange& currentRange = currentOpt.GetSourceWordsRange();
const Range& currentRange = currentOpt.GetSourceWordsRange();
if (previousOpt) {
const WordsRange& previousRange = previousOpt->GetSourceWordsRange();
const Range& previousRange = previousOpt->GetSourceWordsRange();
if (previousRange < currentRange) {
gapStart = previousRange.GetEndPos() + 1;
gapEnd = currentRange.GetStartPos();

View File

@ -5,7 +5,7 @@
#include "moses/InputPath.h"
#include "moses/TargetPhrase.h"
#include "moses/StackVec.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/ChartCellLabel.h"
#include "moses/FactorCollection.h"

View File

@ -54,7 +54,7 @@ void NieceTerminal::EvaluateWithSourceContext(const InputType &input
for (size_t i = 0; i < stackVec->size(); ++i) {
const ChartCellLabel &cell = *stackVec->at(i);
const WordsRange &ntRange = cell.GetCoverage();
const Range &ntRange = cell.GetCoverage();
bool containTerm = ContainTerm(input, ntRange, terms);
if (containTerm) {
@ -79,7 +79,7 @@ void NieceTerminal::EvaluateWhenApplied(const ChartHypothesis &hypo,
{}
bool NieceTerminal::ContainTerm(const InputType &input,
const WordsRange &ntRange,
const Range &ntRange,
const boost::unordered_set<Word> &terms) const
{
boost::unordered_set<Word>::const_iterator iter;

View File

@ -6,7 +6,7 @@
namespace Moses
{
class WordsRange;
class Range;
class Word;
// 1 of the non-term covers the same word as 1 of the terminals
@ -45,7 +45,7 @@ public:
protected:
bool m_hardConstraint;
bool ContainTerm(const InputType &input,
const WordsRange &ntRange,
const Range &ntRange,
const boost::unordered_set<Word> &terms) const;
};

View File

@ -120,7 +120,7 @@ FFState* OpSequenceModel::EvaluateWhenApplied(
//const Sentence &sentence = static_cast<const Sentence&>(curr_hypo.GetManager().GetSource());
const WordsRange & sourceRange = cur_hypo.GetCurrSourceWordsRange();
const Range & sourceRange = cur_hypo.GetCurrSourceWordsRange();
int startIndex = sourceRange.GetStartPos();
int endIndex = sourceRange.GetEndPos();
const AlignmentInfo &align = cur_hypo.GetCurrTargetPhrase().GetAlignTerm();

View File

@ -762,7 +762,7 @@ void PhraseOrientationFeature::SparseWordL2RScore(const ChartHypothesis* hypo,
// source word
WordsRange sourceSpan = hypo->GetCurrSourceRange();
Range sourceSpan = hypo->GetCurrSourceRange();
const InputType& input = hypo->GetManager().GetSource();
const Sentence& sourceSentence = static_cast<const Sentence&>(input);
const Word& sourceWord = sourceSentence.GetWord(sourceSpan.GetStartPos());
@ -821,7 +821,7 @@ void PhraseOrientationFeature::SparseWordR2LScore(const ChartHypothesis* hypo,
// source word
WordsRange sourceSpan = hypo->GetCurrSourceRange();
Range sourceSpan = hypo->GetCurrSourceRange();
const InputType& input = hypo->GetManager().GetSource();
const Sentence& sourceSentence = static_cast<const Sentence&>(input);
const Word& sourceWord = sourceSentence.GetWord(sourceSpan.GetEndPos());

View File

@ -297,7 +297,7 @@ void SoftSourceSyntacticConstraintsFeature::EvaluateWithSourceContext(const Inpu
FEATUREVERBOSE(3, inputPath << std::endl);
for (size_t i = 0; i < stackVec->size(); ++i) {
const ChartCellLabel &cell = *stackVec->at(i);
const WordsRange &ntRange = cell.GetCoverage();
const Range &ntRange = cell.GetCoverage();
FEATUREVERBOSE(3, "stackVec[ " << i << " ] : " << ntRange.GetStartPos() << " - " << ntRange.GetEndPos() << std::endl);
}
@ -339,9 +339,9 @@ void SoftSourceSyntacticConstraintsFeature::EvaluateWithSourceContext(const Inpu
boost::unordered_set<size_t> treeInputLabelsLHS;
// get index map for underlying hypotheses
const WordsRange& wordsRange = inputPath.GetWordsRange();
size_t startPos = wordsRange.GetStartPos();
size_t endPos = wordsRange.GetEndPos();
const Range& range = inputPath.GetWordsRange();
size_t startPos = range.GetStartPos();
size_t endPos = range.GetEndPos();
const Phrase *sourcePhrase = targetPhrase.GetRuleSource();
if (nNTs > 1) { // rule has right-hand side non-terminals, i.e. it's a hierarchical rule
@ -356,7 +356,7 @@ void SoftSourceSyntacticConstraintsFeature::EvaluateWithSourceContext(const Inpu
if ( word.IsNonTerminal() ) {
// retrieve information that is required for input tree label matching (RHS)
const ChartCellLabel &cell = *stackVec->at(nonTerminalNumber);
const WordsRange& prevWordsRange = cell.GetCoverage();
const Range& prevWordsRange = cell.GetCoverage();
symbolStartPos = prevWordsRange.GetStartPos();
symbolEndPos = prevWordsRange.GetEndPos();
}

View File

@ -39,9 +39,9 @@ void SourceGHKMTreeInputMatchFeature::EvaluateWithSourceContext(const InputType
, ScoreComponentCollection &scoreBreakdown
, ScoreComponentCollection *estimatedFutureScore) const
{
const WordsRange& wordsRange = inputPath.GetWordsRange();
size_t startPos = wordsRange.GetStartPos();
size_t endPos = wordsRange.GetEndPos();
const Range& range = inputPath.GetWordsRange();
size_t startPos = range.GetStartPos();
size_t endPos = range.GetEndPos();
const TreeInput& treeInput = static_cast<const TreeInput&>(input);
const NonTerminalSet& treeInputLabels = treeInput.GetLabelSet(startPos,endPos);
const Word& lhsLabel = targetPhrase.GetTargetLHS();

View File

@ -3,7 +3,7 @@
#include "moses/StaticData.h"
#include "moses/Word.h"
#include "moses/ChartCellLabel.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/StackVec.h"
#include "moses/TargetPhrase.h"
#include "moses/PP/PhraseProperty.h"
@ -50,7 +50,7 @@ void SpanLength::EvaluateWithSourceContext(const InputType &input
float score = 0;
for (size_t i = 0; i < stackVec->size(); ++i) {
const ChartCellLabel &cell = *stackVec->at(i);
const WordsRange &ntRange = cell.GetCoverage();
const Range &ntRange = cell.GetCoverage();
size_t sourceWidth = ntRange.GetNumWordsCovered();
float prob = slProp->GetProb(i, sourceWidth, m_const);
score += TransformScore(prob);

View File

@ -112,7 +112,7 @@ void SparseHieroReorderingFeature::EvaluateWhenApplied(
size_t sourceStart = cur_hypo.GetCurrSourceRange().GetStartPos();
size_t sourceSize = cur_hypo.GetCurrSourceRange().GetNumWordsCovered();
vector<WordsRange> sourceNTSpans;
vector<Range> sourceNTSpans;
for (size_t prevHypoId = 0; prevHypoId < cur_hypo.GetPrevHypos().size(); ++prevHypoId) {
sourceNTSpans.push_back(cur_hypo.GetPrevHypo(prevHypoId)->GetCurrSourceRange());
}
@ -122,21 +122,21 @@ void SparseHieroReorderingFeature::EvaluateWhenApplied(
//for (size_t i = 0; i < sourceNTSpans.size(); ++i) cerr << sourceNTSpans[i] << " ";
//cerr << endl;
typedef pair<WordsRange,bool> Block;//flag indicates NT
typedef pair<Range,bool> Block;//flag indicates NT
vector<Block> sourceBlocks;
sourceBlocks.push_back(Block(cur_hypo.GetCurrSourceRange(),false));
for (vector<WordsRange>::const_iterator i = sourceNTSpans.begin();
for (vector<Range>::const_iterator i = sourceNTSpans.begin();
i != sourceNTSpans.end(); ++i) {
const WordsRange& prevHypoRange = *i;
const Range& prevHypoRange = *i;
Block lastBlock = sourceBlocks.back();
sourceBlocks.pop_back();
//split this range into before NT, NT and after NT
if (prevHypoRange.GetStartPos() > lastBlock.first.GetStartPos()) {
sourceBlocks.push_back(Block(WordsRange(lastBlock.first.GetStartPos(),prevHypoRange.GetStartPos()-1),false));
sourceBlocks.push_back(Block(Range(lastBlock.first.GetStartPos(),prevHypoRange.GetStartPos()-1),false));
}
sourceBlocks.push_back(Block(prevHypoRange,true));
if (prevHypoRange.GetEndPos() < lastBlock.first.GetEndPos()) {
sourceBlocks.push_back(Block(WordsRange(prevHypoRange.GetEndPos()+1,lastBlock.first.GetEndPos()), false));
sourceBlocks.push_back(Block(Range(prevHypoRange.GetEndPos()+1,lastBlock.first.GetEndPos()), false));
}
}
/*

View File

@ -60,7 +60,7 @@ private:
typedef boost::unordered_set<const Factor*> Vocab;
void AddNonTerminalPairFeatures(
const Sentence& sentence, const WordsRange& nt1, const WordsRange& nt2,
const Sentence& sentence, const Range& nt1, const Range& nt2,
bool isMonotone, ScoreComponentCollection* accumulator) const;
void LoadVocabulary(const std::string& filename, Vocab& vocab);

View File

@ -132,7 +132,7 @@ public:
:m_contextPrefix(order - 1),
m_contextSuffix(order - 1) {
m_numTargetTerminals = hypo.GetCurrTargetPhrase().GetNumTerminals();
const WordsRange range = hypo.GetCurrSourceRange();
const Range range = hypo.GetCurrSourceRange();
m_startPos = range.GetStartPos();
m_endPos = range.GetEndPos();
m_inputSize = hypo.GetManager().GetSource().GetSize();

View File

@ -7,7 +7,7 @@
namespace Moses
{
class WordsRange;
class Range;
/** unknown word penalty */

View File

@ -73,7 +73,7 @@ int ForestInput::Read(std::istream &in,
{
Word symbol;
symbol.CreateFromString(Input, factorOrder, "<s>", false);
Syntax::PVertex pvertex(WordsRange(0, 0), symbol);
Syntax::PVertex pvertex(Range(0, 0), symbol);
startSymbol = new Forest::Vertex(pvertex);
m_forest->vertices.push_back(startSymbol);
}
@ -83,7 +83,7 @@ int ForestInput::Read(std::istream &in,
{
Word symbol;
symbol.CreateFromString(Input, factorOrder, "</s>", false);
Syntax::PVertex pvertex(WordsRange(maxEnd+1, maxEnd+1), symbol);
Syntax::PVertex pvertex(Range(maxEnd+1, maxEnd+1), symbol);
endSymbol = new Forest::Vertex(pvertex);
m_forest->vertices.push_back(endSymbol);
}
@ -92,7 +92,7 @@ int ForestInput::Read(std::istream &in,
{
Word symbol;
symbol.CreateFromString(Input, factorOrder, "Q", true);
Syntax::PVertex pvertex(WordsRange(0, maxEnd+1), symbol);
Syntax::PVertex pvertex(Range(0, maxEnd+1), symbol);
m_rootVertex = new Forest::Vertex(pvertex);
m_forest->vertices.push_back(m_rootVertex);
}
@ -189,7 +189,7 @@ void ForestInput::ParseHyperedgeLine(
v = ParseVertex(*p, factorOrder);
if (!v->pvertex.symbol.IsNonTerminal()) {
// Egret does not give start/end for terminals.
v->pvertex.span = WordsRange(e->head->pvertex.span.GetStartPos(),
v->pvertex.span = Range(e->head->pvertex.span.GetStartPos(),
e->head->pvertex.span.GetStartPos());
}
e->tail.push_back(AddOrDeleteVertex(v));
@ -211,7 +211,7 @@ Syntax::F2S::Forest::Vertex *ForestInput::ParseVertex(
if (pos == std::string::npos) {
symbol.CreateFromString(Input, factorOrder, s, false);
// Create vertex: caller will fill in span.
WordsRange span(0, 0);
Range span(0, 0);
return new Forest::Vertex(Syntax::PVertex(span, symbol));
}
symbol.CreateFromString(Input, factorOrder, s.substr(0, pos), true);
@ -223,7 +223,7 @@ Syntax::F2S::Forest::Vertex *ForestInput::ParseVertex(
s.substr(pos+1, s.size()-pos-2).CopyToString(&tmp);
std::size_t end = std::atoi(tmp.c_str());
// Create vertex: offset span by 1 to allow for <s> in first position.
WordsRange span(start+1, end+1);
Range span(start+1, end+1);
return new Forest::Vertex(Syntax::PVertex(span, symbol));
}

View File

@ -246,7 +246,7 @@ PrintHypothesis() const
TRACE_ERR( "... ");
}
if (end>=0) {
WordsRange range(start, end);
Range range(start, end);
TRACE_ERR( m_prevHypo->GetCurrTargetPhrase().GetSubString(range) << " ");
}
TRACE_ERR( ")"<<endl);
@ -523,7 +523,7 @@ OutputSurface(std::ostream &out, const Hypothesis &edge,
// trace ("report segmentation") option "-t" / "-tt"
if (reportSegmentation > 0 && phrase.GetSize() > 0) {
const WordsRange &sourceRange = edge.GetCurrSourceWordsRange();
const Range &sourceRange = edge.GetCurrSourceWordsRange();
const int sourceStart = sourceRange.GetStartPos();
const int sourceEnd = sourceRange.GetEndPos();
out << "|" << sourceStart << "-" << sourceEnd; // enriched "-tt"
@ -604,8 +604,8 @@ Hypothesis::
OutputLocalWordAlignment(vector<xmlrpc_c::value>& dest) const
{
using namespace std;
WordsRange const& src = this->GetCurrSourceWordsRange();
WordsRange const& trg = this->GetCurrTargetWordsRange();
Range const& src = this->GetCurrSourceWordsRange();
Range const& trg = this->GetCurrTargetWordsRange();
vector<pair<size_t,size_t> const* > a
= this->GetCurrTargetPhrase().GetAlignTerm().GetSortedAlignments();

View File

@ -49,7 +49,7 @@ namespace Moses
class SquareMatrix;
class StaticData;
class TranslationOption;
class WordsRange;
class Range;
class Hypothesis;
class FFState;
class StatelessFeatureFunction;
@ -74,8 +74,8 @@ protected:
const Hypothesis* m_prevHypo; /*! backpointer to previous hypothesis (from which this one was created) */
const Bitmap &m_sourceCompleted; /*! keeps track of which words have been translated so far */
InputType const& m_sourceInput;
WordsRange m_currSourceWordsRange; /*! source word positions of the last phrase that was used to create this hypothesis */
WordsRange m_currTargetWordsRange; /*! target word positions of the last phrase that was used to create this hypothesis */
Range m_currSourceWordsRange; /*! source word positions of the last phrase that was used to create this hypothesis */
Range m_currTargetWordsRange; /*! target word positions of the last phrase that was used to create this hypothesis */
bool m_wordDeleted;
float m_totalScore; /*! score so far */
float m_futureScore; /*! estimated future cost to translate rest of sentence */
@ -108,11 +108,11 @@ public:
const TargetPhrase &GetCurrTargetPhrase() const;
/** return input positions covered by the translation option (phrasal translation) used to create this hypothesis */
inline const WordsRange &GetCurrSourceWordsRange() const {
inline const Range &GetCurrSourceWordsRange() const {
return m_currSourceWordsRange;
}
inline const WordsRange &GetCurrTargetWordsRange() const {
inline const Range &GetCurrTargetWordsRange() const {
return m_currTargetWordsRange;
}

View File

@ -250,7 +250,7 @@ void HypothesisStackCubePruning::CleanupArcList()
void HypothesisStackCubePruning::SetBitmapAccessor(const Bitmap &newBitmap
, HypothesisStackCubePruning &stack
, const WordsRange &/*range*/
, const Range &/*range*/
, BitmapContainer &bitmapContainer
, const SquareMatrix &futureScore
, const TranslationOptionList &transOptList)

View File

@ -121,7 +121,7 @@ public:
void SetBitmapAccessor(const Bitmap &newBitmap
, HypothesisStackCubePruning &stack
, const WordsRange &range
, const Range &range
, BitmapContainer &bitmapContainer
, const SquareMatrix &futureScore
, const TranslationOptionList &transOptList);

View File

@ -46,7 +46,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include "moses/TypeDef.h"
#include "moses/Util.h"
#include "moses/Hypothesis.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/TrellisPathList.h"
#include "moses/StaticData.h"
#include "moses/FeatureVector.h"

View File

@ -81,9 +81,9 @@ public:
Fill(search::Context<Model> &context, const std::vector<lm::WordIndex> &vocab_mapping, search::Score oov_weight)
: context_(context), vocab_mapping_(vocab_mapping), oov_weight_(oov_weight) {}
void Add(const TargetPhraseCollection &targets, const StackVec &nts, const WordsRange &ignored);
void Add(const TargetPhraseCollection &targets, const StackVec &nts, const Range &ignored);
void AddPhraseOOV(TargetPhrase &phrase, std::list<TargetPhraseCollection::shared_ptr > &waste_memory, const WordsRange &range);
void AddPhraseOOV(TargetPhrase &phrase, std::list<TargetPhraseCollection::shared_ptr > &waste_memory, const Range &range);
float GetBestScore(const ChartCellLabel *chartCell) const;
@ -119,7 +119,7 @@ private:
const search::Score oov_weight_;
};
template <class Model> void Fill<Model>::Add(const TargetPhraseCollection &targets, const StackVec &nts, const WordsRange &range)
template <class Model> void Fill<Model>::Add(const TargetPhraseCollection &targets, const StackVec &nts, const Range &range)
{
std::vector<search::PartialVertex> vertices;
vertices.reserve(nts.size());
@ -160,7 +160,7 @@ template <class Model> void Fill<Model>::Add(const TargetPhraseCollection &targe
}
}
template <class Model> void Fill<Model>::AddPhraseOOV(TargetPhrase &phrase, std::list<TargetPhraseCollection::shared_ptr > &, const WordsRange &range)
template <class Model> void Fill<Model>::AddPhraseOOV(TargetPhrase &phrase, std::list<TargetPhraseCollection::shared_ptr > &, const Range &range)
{
std::vector<lm::WordIndex> words;
UTIL_THROW_IF2(phrase.GetSize() > 1,
@ -245,14 +245,14 @@ PopulateBest(const Model &model, const std::vector<lm::WordIndex> &words, Best &
if (startPos == 0 && startPos + width == size) {
break;
}
WordsRange range(startPos, startPos + width - 1);
Range range(startPos, startPos + width - 1);
Fill<Model> filler(context, words, oov_weight);
parser_.Create(range, filler);
filler.Search(out, cells_.MutableBase(range).MutableTargetLabelSet(), vertex_pool);
}
}
WordsRange range(0, size - 1);
Range range(0, size - 1);
Fill<Model> filler(context, words, oov_weight);
parser_.Create(range, filler);
return filler.RootSearch(out);
@ -420,7 +420,7 @@ void Manager::ReconstructApplicationContext(const search::Applied *applied,
ApplicationContext &context) const
{
context.clear();
const WordsRange &span = applied->GetRange();
const Range &span = applied->GetRange();
const search::Applied *child = applied->Children();
size_t i = span.GetStartPos();
size_t j = 0;
@ -429,12 +429,12 @@ void Manager::ReconstructApplicationContext(const search::Applied *applied,
if (j == applied->GetArity() || i < child->GetRange().GetStartPos()) {
// Symbol is a terminal.
const Word &symbol = sentence.GetWord(i);
context.push_back(std::make_pair(symbol, WordsRange(i, i)));
context.push_back(std::make_pair(symbol, Range(i, i)));
++i;
} else {
// Symbol is a non-terminal.
const Word &symbol = static_cast<const TargetPhrase*>(child->GetNote().vp)->GetTargetLHS();
const WordsRange &range = child->GetRange();
const Range &range = child->GetRange();
context.push_back(std::make_pair(symbol, range));
i = range.GetEndPos()+1;
++child;

View File

@ -14,7 +14,7 @@ InputPath::
InputPath(ttaskwptr const theTask,
Phrase const& phrase,
NonTerminalSet const& sourceNonTerms,
WordsRange const& range, InputPath const *prevNode,
Range const& range, InputPath const *prevNode,
const ScorePair *inputScore)
: ttask(theTask)
, m_prevPath(prevNode)

View File

@ -5,7 +5,7 @@
#include <iostream>
#include <vector>
#include "Phrase.h"
#include "WordsRange.h"
#include "Range.h"
#include "NonTerminal.h"
#include "moses/FactorCollection.h"
#include <boost/shared_ptr.hpp>
@ -44,7 +44,7 @@ public:
protected:
const InputPath *m_prevPath;
Phrase m_phrase;
WordsRange m_range;
Range m_range;
const ScorePair *m_inputScore;
size_t m_nextNode; // distance to next node. For lattices
@ -68,7 +68,7 @@ public:
InputPath(ttaskwptr const ttask,
Phrase const& phrase,
NonTerminalSet const& sourceNonTerms,
WordsRange const& range,
Range const& range,
InputPath const* prevNode,
ScorePair const* inputScore);
@ -83,7 +83,7 @@ public:
const std::vector<bool> &GetNonTerminalArray() const {
return m_sourceNonTermArray;
}
const WordsRange &GetWordsRange() const {
const Range &GetWordsRange() const {
return m_range;
}
const Word &GetLastWord() const;

View File

@ -47,7 +47,7 @@ std::ostream& operator<<(std::ostream& out,InputType const& x)
}
// default implementation is one column equals one word
int InputType::ComputeDistortionDistance(const WordsRange& prev, const WordsRange& current) const
int InputType::ComputeDistortionDistance(const Range& prev, const Range& current) const
{
int dist = 0;
if (prev.GetNumWordsCovered() == 0) {

View File

@ -30,7 +30,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "TargetPhraseCollection.h"
#include "ReorderingConstraint.h"
#include "NonTerminal.h"
#include "WordsRange.h"
#include "Range.h"
namespace Moses
{
@ -133,18 +133,18 @@ public:
m_passthrough = passthrough;
}
//! returns the number of words moved
virtual int ComputeDistortionDistance(const WordsRange& prev, const WordsRange& current) const;
virtual int ComputeDistortionDistance(const Range& prev, const Range& current) const;
//! In a word lattice, tells you if there's a path from node start to node end
virtual bool CanIGetFromAToB(size_t start, size_t end) const;
//! is there a path covering [range] (lattice only, otherwise true)
inline bool IsCoveragePossible(const WordsRange& range) const {
inline bool IsCoveragePossible(const Range& range) const {
return CanIGetFromAToB(range.GetStartPos(), range.GetEndPos() + 1);
}
//! In a word lattice, you can't always get from node A to node B
inline bool IsExtensionPossible(const WordsRange& prev, const WordsRange& current) const {
inline bool IsExtensionPossible(const Range& prev, const Range& current) const {
// return ComputeDistortionDistance(prev, current) < 100000;
size_t t = prev.GetEndPos()+1; // 2
size_t l = current.GetEndPos()+1; //l=1
@ -194,7 +194,7 @@ public:
CreateTranslationOptionCollection(ttasksptr const& ttask) const=0;
//! return substring. Only valid for Sentence class. TODO - get rid of this fn
virtual Phrase GetSubString(const WordsRange&) const =0;
virtual Phrase GetSubString(const Range&) const =0;
//! return substring at a particular position. Only valid for Sentence class. TODO - get rid of this fn
virtual const Word& GetWord(size_t pos) const=0;

View File

@ -108,7 +108,7 @@ void BilingualLM::getSourceWords(
const TargetPhrase &targetPhrase,
int targetWordIdx,
const Sentence &source_sent,
const WordsRange &sourceWordRange,
const Range &sourceWordRange,
std::vector<int> &words) const
{
//Get source context
@ -220,7 +220,7 @@ FFState* BilingualLM::EvaluateWhenApplied(
float value = 0;
const TargetPhrase& currTargetPhrase = cur_hypo.GetCurrTargetPhrase();
const WordsRange& sourceWordRange = cur_hypo.GetCurrSourceWordsRange(); //Source words range to calculate offsets
const Range& sourceWordRange = cur_hypo.GetCurrSourceWordsRange(); //Source words range to calculate offsets
// For each word in the current target phrase get its LM score.
for (int i = 0; i < currTargetPhrase.GetSize(); i++) {

View File

@ -64,7 +64,7 @@ private:
const TargetPhrase &targetPhrase,
int targetWordIdx,
const Sentence &source_sent,
const WordsRange &sourceWordRange,
const Range &sourceWordRange,
std::vector<int> &words) const;
void appendSourceWordsToVector(const Sentence &source_sent, std::vector<int> &words, int source_word_mid_idx) const;

View File

@ -1676,8 +1676,8 @@ void Manager::OutputNBest(std::ostream& out
out << " |||";
for (int currEdge = (int)edges.size() - 2 ; currEdge >= 0 ; currEdge--) {
const Hypothesis &edge = *edges[currEdge];
const WordsRange &sourceRange = edge.GetCurrSourceWordsRange();
WordsRange targetRange = path.GetTargetWordsRange(edge);
const Range &sourceRange = edge.GetCurrSourceWordsRange();
Range targetRange = path.GetTargetWordsRange(edge);
out << " " << sourceRange.GetStartPos();
if (sourceRange.GetStartPos() < sourceRange.GetEndPos()) {
out << "-" << sourceRange.GetEndPos();
@ -1693,8 +1693,8 @@ void Manager::OutputNBest(std::ostream& out
out << " ||| ";
for (int currEdge = (int)edges.size() - 2 ; currEdge >= 0 ; currEdge--) {
const Hypothesis &edge = *edges[currEdge];
const WordsRange &sourceRange = edge.GetCurrSourceWordsRange();
WordsRange targetRange = path.GetTargetWordsRange(edge);
const Range &sourceRange = edge.GetCurrSourceWordsRange();
Range targetRange = path.GetTargetWordsRange(edge);
const int sourceOffset = sourceRange.GetStartPos();
const int targetOffset = targetRange.GetStartPos();
const AlignmentInfo &ai = edge.GetCurrTargetPhrase().GetAlignTerm();
@ -1775,7 +1775,7 @@ void Manager::OutputSurface(std::ostream &out, const Hypothesis &edge, const std
// trace ("report segmentation") option "-t" / "-tt"
if (reportSegmentation > 0 && phrase.GetSize() > 0) {
const WordsRange &sourceRange = edge.GetCurrSourceWordsRange();
const Range &sourceRange = edge.GetCurrSourceWordsRange();
const int sourceStart = sourceRange.GetStartPos();
const int sourceEnd = sourceRange.GetEndPos();
out << "|" << sourceStart << "-" << sourceEnd; // enriched "-tt"

View File

@ -55,14 +55,14 @@ MockHypothesisGuard
vector<string>::const_iterator ti = targetSegments.begin();
for (; ti != targetSegments.end() && ai != alignments.end(); ++ti,++ai) {
Hypothesis* prevHypo = m_hypothesis;
WordsRange wordsRange(ai->first,ai->second);
const Bitmap &newBitmap = bitmaps.GetBitmap(prevHypo->GetWordsBitmap(), wordsRange);
Range range(ai->first,ai->second);
const Bitmap &newBitmap = bitmaps.GetBitmap(prevHypo->GetWordsBitmap(), range);
m_targetPhrases.push_back(TargetPhrase(NULL));
// m_targetPhrases.back().CreateFromString(Input, factors, *ti, "|", NULL);
m_targetPhrases.back().CreateFromString(Input, factors, *ti, NULL);
m_toptions.push_back(new TranslationOption
(wordsRange,m_targetPhrases.back()));
(range,m_targetPhrases.back()));
m_hypothesis = new Hypothesis(*prevHypo, *m_toptions.back(), newBitmap);
}

View File

@ -89,11 +89,11 @@ void Phrase::MergeFactors(const Phrase &copy, const std::vector<FactorType>& fac
}
Phrase Phrase::GetSubString(const WordsRange &wordsRange) const
Phrase Phrase::GetSubString(const Range &range) const
{
Phrase retPhrase(wordsRange.GetNumWordsCovered());
Phrase retPhrase(range.GetNumWordsCovered());
for (size_t currPos = wordsRange.GetStartPos() ; currPos <= wordsRange.GetEndPos() ; currPos++) {
for (size_t currPos = range.GetStartPos() ; currPos <= range.GetEndPos() ; currPos++) {
Word &word = retPhrase.AddWord();
word = GetWord(currPos);
}
@ -101,11 +101,11 @@ Phrase Phrase::GetSubString(const WordsRange &wordsRange) const
return retPhrase;
}
Phrase Phrase::GetSubString(const WordsRange &wordsRange, FactorType factorType) const
Phrase Phrase::GetSubString(const Range &range, FactorType factorType) const
{
Phrase retPhrase(wordsRange.GetNumWordsCovered());
Phrase retPhrase(range.GetNumWordsCovered());
for (size_t currPos = wordsRange.GetStartPos() ; currPos <= wordsRange.GetEndPos() ; currPos++) {
for (size_t currPos = range.GetStartPos() ; currPos <= range.GetEndPos() ; currPos++) {
const Factor* f = GetFactor(currPos, factorType);
Word &word = retPhrase.AddWord();
word.SetFactor(factorType, f);

View File

@ -39,7 +39,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
namespace Moses
{
class FactorMask;
class WordsRange;
class Range;
/** Representation of a phrase, ie. a contiguous number of words.
* Wrapper for vector of words
@ -174,8 +174,8 @@ public:
void InitStartEndWord();
//! create new phrase class that is a substring of this phrase
Phrase GetSubString(const WordsRange &wordsRange) const;
Phrase GetSubString(const WordsRange &wordsRange, FactorType factorType) const;
Phrase GetSubString(const Range &range) const;
Phrase GetSubString(const Range &range, FactorType factorType) const;
//! return a string rep of the phrase. Each factor is separated by the factor delimiter as specified in StaticData class
std::string GetStringRep(const std::vector<FactorType> factorsToPrint) const;

View File

@ -17,14 +17,14 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
***********************************************************************/
#include "WordsRange.h"
#include "Range.h"
namespace Moses
{
TO_STRING_BODY(WordsRange);
TO_STRING_BODY(Range);
std::ostream& operator << (std::ostream& out, const WordsRange& range)
std::ostream& operator << (std::ostream& out, const Range& range)
{
out << "[" << range.m_startPos << ".." << range.m_endPos << "]";
return out;

View File

@ -38,15 +38,15 @@ namespace Moses
/***
* Efficient version of Bitmap for contiguous ranges
*/
class WordsRange
class Range
{
friend std::ostream& operator << (std::ostream& out, const WordsRange& range);
friend std::ostream& operator << (std::ostream& out, const Range& range);
// m_endPos is inclusive
size_t m_startPos, m_endPos;
public:
inline WordsRange(size_t startPos, size_t endPos) : m_startPos(startPos), m_endPos(endPos) {}
inline WordsRange(const WordsRange &copy)
inline Range(size_t startPos, size_t endPos) : m_startPos(startPos), m_endPos(endPos) {}
inline Range(const Range &copy)
: m_startPos(copy.GetStartPos())
, m_endPos(copy.GetEndPos()) {
}
@ -64,24 +64,24 @@ public:
}
//! transitive comparison
inline bool operator<(const WordsRange& x) const {
inline bool operator<(const Range& x) const {
return (m_startPos<x.m_startPos
|| (m_startPos==x.m_startPos && m_endPos<x.m_endPos));
}
// equality operator
inline bool operator==(const WordsRange& x) const {
inline bool operator==(const Range& x) const {
return (m_startPos==x.m_startPos && m_endPos==x.m_endPos);
}
// Whether two word ranges overlap or not
inline bool Overlap(const WordsRange& x) const {
inline bool Overlap(const Range& x) const {
if ( x.m_endPos < m_startPos || x.m_startPos > m_endPos) return false;
return true;
}
inline size_t GetNumWordsBetween(const WordsRange& x) const {
inline size_t GetNumWordsBetween(const Range& x) const {
UTIL_THROW_IF2(Overlap(x), "Overlapping ranges");
if (x.m_endPos < m_startPos) {
@ -95,7 +95,7 @@ public:
TO_STRING();
};
inline size_t hash_value(const WordsRange& range)
inline size_t hash_value(const Range& range)
{
size_t seed = range.GetStartPos();
boost::hash_combine(seed, range.GetEndPos());

View File

@ -26,7 +26,7 @@
#include "RuleCubeQueue.h"
#include "StaticData.h"
#include "Util.h"
#include "WordsRange.h"
#include "Range.h"
#include <boost/functional/hash.hpp>

View File

@ -23,7 +23,7 @@
#include "ChartManager.h"
#include "RuleCubeItem.h"
#include "RuleCubeQueue.h"
#include "WordsRange.h"
#include "Range.h"
#include "Util.h"
#include "util/exception.hh"

View File

@ -200,7 +200,7 @@ void SearchCubePruning::CreateForwardTodos(HypothesisStackCubePruning &stack)
continue;
// not yet covered
WordsRange applyRange(startPos, startPos);
Range applyRange(startPos, startPos);
if (CheckDistortion(bitmap, applyRange)) {
// apply range
CreateForwardTodos(bitmap, applyRange, bitmapContainer);
@ -213,7 +213,7 @@ void SearchCubePruning::CreateForwardTodos(HypothesisStackCubePruning &stack)
if (bitmap.GetValue(endPos))
break;
WordsRange applyRange(startPos, endPos);
Range applyRange(startPos, endPos);
if (CheckDistortion(bitmap, applyRange)) {
// apply range
CreateForwardTodos(bitmap, applyRange, bitmapContainer);
@ -225,7 +225,7 @@ void SearchCubePruning::CreateForwardTodos(HypothesisStackCubePruning &stack)
void
SearchCubePruning::
CreateForwardTodos(Bitmap const& bitmap, WordsRange const& range,
CreateForwardTodos(Bitmap const& bitmap, Range const& range,
BitmapContainer& bitmapContainer)
{
Bitmap newBitmap = bitmap;
@ -246,7 +246,7 @@ CreateForwardTodos(Bitmap const& bitmap, WordsRange const& range,
bool
SearchCubePruning::
CheckDistortion(const Bitmap &hypoBitmap, const WordsRange &range) const
CheckDistortion(const Bitmap &hypoBitmap, const Range &range) const
{
// since we check for reordering limits, its good to have that limit handy
int maxDistortion = m_manager.options().reordering.max_distortion;
@ -274,7 +274,7 @@ CheckDistortion(const Bitmap &hypoBitmap, const WordsRange &range) const
// its maximum value will be (which will always be the value of the
// hypothesis starting at the left-most edge). If this vlaue is than
// the distortion limit, we don't allow this extension to be made.
WordsRange bestNextExtension(hypoFirstGapPos, hypoFirstGapPos);
Range bestNextExtension(hypoFirstGapPos, hypoFirstGapPos);
return (m_source.ComputeDistortionDistance(range, bestNextExtension)
<= maxDistortion);
}

View File

@ -27,8 +27,8 @@ protected:
//! go thru all bitmaps in 1 stack & create backpointers to bitmaps in the stack
void CreateForwardTodos(HypothesisStackCubePruning &stack);
//! create a back pointer to this bitmap, with edge that has this words range translation
void CreateForwardTodos(const Bitmap &bitmap, const WordsRange &range, BitmapContainer &bitmapContainer);
bool CheckDistortion(const Bitmap &bitmap, const WordsRange &range) const;
void CreateForwardTodos(const Bitmap &bitmap, const Range &range, BitmapContainer &bitmapContainer);
bool CheckDistortion(const Bitmap &bitmap, const Range &range) const;
void PrintBitmapContainerGraph();

View File

@ -131,7 +131,7 @@ ProcessOneHypothesis(const Hypothesis &hypothesis)
tol && endPos < sourceSize;
tol = m_transOptColl.GetTranslationOptionList(startPos, ++endPos)) {
if (tol->size() == 0
|| hypoBitmap.Overlap(WordsRange(startPos, endPos))
|| hypoBitmap.Overlap(Range(startPos, endPos))
|| !ReoConstraint.Check(hypoBitmap, startPos, endPos)) {
continue;
}
@ -145,7 +145,7 @@ ProcessOneHypothesis(const Hypothesis &hypothesis)
// There are reordering limits. Make sure they are not violated.
WordsRange prevRange = hypothesis.GetCurrSourceWordsRange();
Range prevRange = hypothesis.GetCurrSourceWordsRange();
for (size_t startPos = hypoFirstGapPos ; startPos < sourceSize ; ++startPos) {
// don't bother expanding phrases if the first position is already taken
@ -176,7 +176,7 @@ ProcessOneHypothesis(const Hypothesis &hypothesis)
continue;
}
WordsRange currentStartRange(startPos, startPos);
Range currentStartRange(startPos, startPos);
if(m_source.ComputeDistortionDistance(prevRange, currentStartRange)
> m_options.reordering.max_distortion)
continue;
@ -186,7 +186,7 @@ ProcessOneHypothesis(const Hypothesis &hypothesis)
for (tol = m_transOptColl.GetTranslationOptionList(startPos, endPos);
tol && endPos < sourceSize;
tol = m_transOptColl.GetTranslationOptionList(startPos, ++endPos)) {
WordsRange extRange(startPos, endPos);
Range extRange(startPos, endPos);
if (tol->size() == 0
|| hypoBitmap.Overlap(extRange)
|| !ReoConstraint.Check(hypoBitmap, startPos, endPos)
@ -224,7 +224,7 @@ ProcessOneHypothesis(const Hypothesis &hypothesis)
// be (which will always be the value of the hypothesis starting
// at the left-most edge). If this value is less than the
// distortion limit, we don't allow this extension to be made.
WordsRange bestNextExtension(hypoFirstGapPos, hypoFirstGapPos);
Range bestNextExtension(hypoFirstGapPos, hypoFirstGapPos);
if (m_source.ComputeDistortionDistance(extRange, bestNextExtension)
> m_options.reordering.max_distortion) continue;
@ -270,7 +270,7 @@ ExpandAllHypotheses(const Hypothesis &hypothesis, size_t startPos, size_t endPos
// Create new bitmap
const TranslationOption &transOpt = **tol->begin();
const WordsRange &nextRange = transOpt.GetSourceWordsRange();
const Range &nextRange = transOpt.GetSourceWordsRange();
const Bitmap &nextBitmap = m_bitmaps.GetBitmap(sourceCompleted, nextRange);
TranslationOptionList::const_iterator iter;

View File

@ -204,7 +204,7 @@ init(string line, std::vector<FactorType> const& factorOrder)
if (SD.GetXmlInputType() != XmlPassThrough) {
m_xmlCoverageMap.assign(GetSize(), false);
BOOST_FOREACH(XmlOption* o, m_xmlOptions) {
WordsRange const& r = o->range;
Range const& r = o->range;
for(size_t j = r.GetStartPos(); j <= r.GetEndPos(); ++j)
m_xmlCoverageMap[j]=true;
}
@ -215,7 +215,7 @@ init(string line, std::vector<FactorType> const& factorOrder)
// set reordering walls, if "-monotone-at-punction" is set
if (SD.UseReorderingConstraint() && GetSize()) {
WordsRange r(0, GetSize()-1);
Range r(0, GetSize()-1);
m_reorderingConstraint.SetMonotoneAtPunctuation(GetSubString(r));
}
@ -289,7 +289,7 @@ void Sentence::GetXmlTranslationOptions(std::vector <TranslationOption*> &list)
for (std::vector<XmlOption*>::const_iterator iterXMLOpts = m_xmlOptions.begin();
iterXMLOpts != m_xmlOptions.end(); ++iterXMLOpts) {
const XmlOption &xmlOption = **iterXMLOpts;
const WordsRange &range = xmlOption.range;
const Range &range = xmlOption.range;
const TargetPhrase &targetPhrase = xmlOption.targetPhrase;
TranslationOption *transOpt = new TranslationOption(range, targetPhrase);
list.push_back(transOpt);
@ -303,7 +303,7 @@ void Sentence::GetXmlTranslationOptions(std::vector <TranslationOption*> &list,
for (std::vector<XmlOption*>::const_iterator iterXMLOpts = m_xmlOptions.begin();
iterXMLOpts != m_xmlOptions.end(); ++iterXMLOpts) {
const XmlOption &xmlOption = **iterXMLOpts;
const WordsRange &range = xmlOption.range;
const Range &range = xmlOption.range;
if (startPos == range.GetStartPos()
&& endPos == range.GetEndPos()) {
@ -338,7 +338,7 @@ std::vector <ChartTranslationOptions*> Sentence::GetXmlChartTranslationOptions()
const XmlOption &xmlOption = **iterXmlOpts;
TargetPhrase *targetPhrase = new TargetPhrase(xmlOption.targetPhrase);
WordsRange *range = new WordsRange(xmlOption.range);
Range *range = new Range(xmlOption.range);
StackVec emptyStackVec; // hmmm... maybe dangerous, but it is never consulted
TargetPhraseCollection *tpc = new TargetPhraseCollection;

View File

@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
namespace Moses
{
class WordsRange;
class Range;
class PhraseDictionary;
class TranslationOption;
class TranslationOptionCollection;
@ -73,7 +73,7 @@ public:
}
//! Calls Phrase::GetSubString(). Implements abstract InputType::GetSubString()
Phrase GetSubString(const WordsRange& r) const {
Phrase GetSubString(const Range& r) const {
return Phrase::GetSubString(r);
}

View File

@ -79,7 +79,7 @@ void DerivationWriter::WriteLine(const SHyperedge &shyperedge,
// Spans covered by source RHS symbols.
for (std::size_t i = 0; i < shyperedge.tail.size(); ++i) {
const SVertex *child = shyperedge.tail[i];
const WordsRange &span = child->pvertex->span;
const Range &span = child->pvertex->span;
out << " " << span.GetStartPos() << ".." << span.GetEndPos();
}

View File

@ -15,7 +15,7 @@
#include "moses/Util.h"
#include "moses/InputFileStream.h"
#include "moses/StaticData.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/ChartTranslationOptionList.h"
#include "moses/FactorCollection.h"
#include "moses/Syntax/RuleTableFF.h"

View File

@ -1,7 +1,7 @@
#pragma once
#include "moses/Word.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
namespace Moses
{
@ -10,9 +10,9 @@ namespace Syntax
struct PVertex {
public:
PVertex(const WordsRange &wr, const Word &w) : span(wr), symbol(w) {}
PVertex(const Range &wr, const Word &w) : span(wr), symbol(w) {}
WordsRange span;
Range span;
Word symbol;
};

View File

@ -78,7 +78,7 @@ void DerivationWriter::WriteLine(const SHyperedge &shyperedge,
// Spans covered by source RHS symbols.
for (std::size_t i = 0; i < shyperedge.tail.size(); ++i) {
const SVertex *child = shyperedge.tail[i];
const WordsRange &span = child->pvertex->span;
const Range &span = child->pvertex->span;
out << " " << span.GetStartPos() << ".." << span.GetEndPos();
}

View File

@ -45,7 +45,7 @@ void Manager<Parser>::InitializeCharts()
const Word &terminal = m_source.GetWord(i);
// PVertex
PVertex tmp(WordsRange(i,i), terminal);
PVertex tmp(Range(i,i), terminal);
PVertex &pvertex = m_pchart.AddVertex(tmp);
// SVertex
@ -184,7 +184,7 @@ void Manager<Parser>::Decode()
//PChart::Cell &pcell = m_pchart.GetCell(start, end);
SChart::Cell &scell = m_schart.GetCell(start, end);
WordsRange range(start, end);
Range range(start, end);
// Call the parsers to generate PHyperedges for this span and convert
// each one to a SHyperedgeBundle (via the callback). The callback

View File

@ -31,7 +31,7 @@ public:
m_container.SwapIn(m_tmpBundle, score);
}
void InitForRange(const WordsRange &range) {
void InitForRange(const Range &range) {
m_container.LazyClear();
}
@ -62,7 +62,7 @@ public:
m_containers[end].SwapIn(m_tmpBundle, score);
}
void InitForRange(const WordsRange &range) {
void InitForRange(const Range &range) {
const std::size_t start = range.GetStartPos();
m_end = range.GetEndPos();
if (start != m_prevStart) {

View File

@ -20,7 +20,7 @@ public:
virtual ~Parser() {}
virtual void EnumerateHyperedges(const WordsRange &, Callback &) = 0;
virtual void EnumerateHyperedges(const Range &, Callback &) = 0;
protected:
PChart &m_chart;
};

View File

@ -24,7 +24,7 @@ RecursiveCYKPlusParser<Callback>::RecursiveCYKPlusParser(
template<typename Callback>
void RecursiveCYKPlusParser<Callback>::EnumerateHyperedges(
const WordsRange &range,
const Range &range,
Callback &callback)
{
const std::size_t start = range.GetStartPos();

View File

@ -4,7 +4,7 @@
#include "moses/Syntax/PVertex.h"
#include "moses/Syntax/S2T/Parsers/Parser.h"
#include "moses/Syntax/S2T/RuleTrieCYKPlus.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
namespace Moses
{
@ -35,7 +35,7 @@ public:
~RecursiveCYKPlusParser() {}
void EnumerateHyperedges(const WordsRange &, Callback &);
void EnumerateHyperedges(const Range &, Callback &);
private:

View File

@ -39,7 +39,7 @@ Scope3Parser<Callback>::~Scope3Parser()
template<typename Callback>
void Scope3Parser<Callback>::
EnumerateHyperedges(const WordsRange &range, Callback &callback)
EnumerateHyperedges(const Range &range, Callback &callback)
{
const std::size_t start = range.GetStartPos();
const std::size_t end = range.GetEndPos();

View File

@ -5,7 +5,7 @@
#include "moses/Syntax/S2T/Parsers/Parser.h"
#include "moses/Syntax/S2T/RuleTrieScope3.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "PatternApplicationTrie.h"
#include "SymbolRangeCalculator.h"
@ -41,7 +41,7 @@ public:
~Scope3Parser();
void EnumerateHyperedges(const WordsRange &, Callback &);
void EnumerateHyperedges(const Range &, Callback &);
private:
void Init();

View File

@ -15,7 +15,7 @@
#include "moses/Util.h"
#include "moses/InputFileStream.h"
#include "moses/StaticData.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/ChartTranslationOptionList.h"
#include "moses/FactorCollection.h"
#include "moses/Syntax/RuleTableFF.h"

View File

@ -50,10 +50,10 @@ void InputTreeBuilder::CreateNodes(const TreeInput &in,
p != xmlNodes.end(); ++p) {
std::size_t start = p->m_range.GetStartPos();
std::size_t end = p->m_range.GetEndPos();
nonTerms.push_back(XMLParseOutput(p->m_label, WordsRange(start+1, end+1)));
nonTerms.push_back(XMLParseOutput(p->m_label, Range(start+1, end+1)));
}
// Add a top-level node that also covers <s> and </s>.
nonTerms.push_back(XMLParseOutput(topLevelLabel, WordsRange(0, numWords-1)));
nonTerms.push_back(XMLParseOutput(topLevelLabel, Range(0, numWords-1)));
// Allocate space for the InputTree nodes. In the case of out.nodes, this
// step is essential because once created the PVertex objects must not be
@ -75,7 +75,7 @@ void InputTreeBuilder::CreateNodes(const TreeInput &in,
// Add a node for each terminal to the left of or below the first
// nonTerm child of the subtree.
for (int i = prevEnd+1; i <= end; ++i) {
PVertex v(WordsRange(i, i), in.GetWord(i));
PVertex v(Range(i, i), in.GetWord(i));
out.nodes.push_back(InputTree::Node(v));
out.nodesAtPos[i].push_back(&out.nodes.back());
}
@ -83,7 +83,7 @@ void InputTreeBuilder::CreateNodes(const TreeInput &in,
// Add a node for the non-terminal.
Word w(true);
w.CreateFromString(Moses::Output, m_outputFactorOrder, p->m_label, true);
PVertex v(WordsRange(start, end), w);
PVertex v(Range(start, end), w);
out.nodes.push_back(InputTree::Node(v));
out.nodesAtPos[start].push_back(&out.nodes.back());

View File

@ -15,7 +15,7 @@
#include "moses/Util.h"
#include "moses/InputFileStream.h"
#include "moses/StaticData.h"
#include "moses/WordsRange.h"
#include "moses/Range.h"
#include "moses/ChartTranslationOptionList.h"
#include "moses/FactorCollection.h"
#include "moses/Syntax/RuleTableFF.h"

View File

@ -46,8 +46,8 @@ void PrintTranslationAnalysis(std::ostream &os, const Hypothesis* hypo)
util::StringStream tms;
std::string target = (*tpi)->GetTargetPhraseStringRep();
std::string source = (*tpi)->GetSourcePhraseStringRep();
WordsRange twr = (*tpi)->GetCurrTargetWordsRange();
WordsRange swr = (*tpi)->GetCurrSourceWordsRange();
Range twr = (*tpi)->GetCurrTargetWordsRange();
Range swr = (*tpi)->GetCurrSourceWordsRange();
const AlignmentInfo &alignmentInfo = (*tpi)->GetCurrTargetPhrase().GetAlignTerm();
// language model backoff stats,
if (doLMStats) {

View File

@ -33,7 +33,7 @@ namespace Moses
void ChartRuleLookupManagerCYKPlus::AddCompletedRule(
const DottedRule &dottedRule,
const TargetPhraseCollection &tpc,
const WordsRange &range,
const Range &range,
ChartParserCallback &outColl)
{
// Determine the rule's rank.

View File

@ -29,7 +29,7 @@ namespace Moses
class DottedRule;
class TargetPhraseCollection;
class WordsRange;
class Range;
/** @todo what is this?
*/
@ -44,7 +44,7 @@ protected:
void AddCompletedRule(
const DottedRule &dottedRule,
const TargetPhraseCollection &tpc,
const WordsRange &range,
const Range &range,
ChartParserCallback &outColl);
StackVec m_stackVec;

View File

@ -56,7 +56,7 @@ void ChartRuleLookupManagerMemory::GetChartRuleCollection(
size_t lastPos,
ChartParserCallback &outColl)
{
const WordsRange &range = inputPath.GetWordsRange();
const Range &range = inputPath.GetWordsRange();
size_t startPos = range.GetStartPos();
size_t absEndPos = range.GetEndPos();

View File

@ -32,7 +32,7 @@ namespace Moses
{
class ChartParserCallback;
class WordsRange;
class Range;
//! Implementation of ChartRuleLookupManager for in-memory rule tables.
class ChartRuleLookupManagerMemory : public ChartRuleLookupManagerCYKPlus

View File

@ -56,7 +56,7 @@ void ChartRuleLookupManagerMemoryPerSentence::GetChartRuleCollection(
size_t lastPos,
ChartParserCallback &outColl)
{
const WordsRange &range = inputPath.GetWordsRange();
const Range &range = inputPath.GetWordsRange();
size_t startPos = range.GetStartPos();
size_t absEndPos = range.GetEndPos();

Some files were not shown because too many files have changed in this diff Show More