Skip to content

Commit

Permalink
WordsRange -> Range
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuhoang committed Oct 25, 2015
1 parent 84b1c4b commit 97b2aa5
Show file tree
Hide file tree
Showing 139 changed files with 376 additions and 376 deletions.
12 changes: 6 additions & 6 deletions contrib/other-builds/moses/.project
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
4 changes: 2 additions & 2 deletions contrib/other-builds/moses/moses.project
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>
Expand Down
2 changes: 1 addition & 1 deletion moses/BaseManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BaseManager
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,
Expand Down
6 changes: 3 additions & 3 deletions moses/Bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -162,7 +162,7 @@ class Bitmap
}

void
SetValue(WordsRange const& range, bool val) {
SetValue(Range const& range, bool val) {
SetValue(range.GetStartPos(), range.GetEndPos(), val);
}

Expand All @@ -171,7 +171,7 @@ class Bitmap
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;
Expand Down
8 changes: 4 additions & 4 deletions moses/BitmapContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class HypothesisScoreOrdererNoDistortion
class HypothesisScoreOrdererWithDistortion
{
public:
HypothesisScoreOrdererWithDistortion(const WordsRange* transOptRange) :
HypothesisScoreOrdererWithDistortion(const Range* transOptRange) :
m_transOptRange(transOptRange) {
m_totalWeightDistortion = 0;
const StaticData &staticData = StaticData::Instance();
Expand All @@ -67,7 +67,7 @@ class HypothesisScoreOrdererWithDistortion
}
}

const WordsRange* m_transOptRange;
const Range* m_transOptRange;
float m_totalWeightDistortion;

bool operator()(const Hypothesis* hypoA, const Hypothesis* hypoB) const {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions moses/Bitmaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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());
Expand Down
6 changes: 3 additions & 3 deletions moses/Bitmaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ 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();

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);

};

Expand Down
2 changes: 1 addition & 1 deletion moses/ChartCell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions moses/ChartCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -60,12 +60,12 @@ class ChartCellBase
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;
};

Expand Down
2 changes: 1 addition & 1 deletion moses/ChartCellCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "ChartCellCollection.h"
#include "InputType.h"
#include "WordsRange.h"
#include "Range.h"
#include "ChartManager.h"

namespace Moses
Expand Down
12 changes: 6 additions & 6 deletions moses/ChartCellCollection.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -51,7 +51,7 @@ class ChartCellCollectionBase
* 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)));
}
Expand All @@ -60,11 +60,11 @@ class ChartCellCollectionBase
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()];
}

Expand All @@ -88,12 +88,12 @@ class ChartCellCollection : public ChartCellCollectionBase
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));
}
};
Expand Down
8 changes: 4 additions & 4 deletions moses/ChartCellLabel.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "HypoList.h"
#include "Word.h"
#include "WordsRange.h"
#include "Range.h"
#include "ChartParserCallback.h"

namespace search
Expand Down Expand Up @@ -49,15 +49,15 @@ class ChartCellLabel
};


ChartCellLabel(const WordsRange &coverage, const Word &label,
ChartCellLabel(const Range &coverage, const Word &label,
Stack stack=Stack())
: m_coverage(coverage)
, m_label(label)
, m_stack(stack)
, m_bestScore(0) {
}

const WordsRange &GetCoverage() const {
const Range &GetCoverage() const {
return m_coverage;
}
const Word &GetLabel() const {
Expand All @@ -79,7 +79,7 @@ class ChartCellLabel
}

private:
const WordsRange &m_coverage;
const Range &m_coverage;
const Word &m_label;
//const InputPath &m_inputPath;
Stack m_stack;
Expand Down
4 changes: 2 additions & 2 deletions moses/ChartCellLabelSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ChartCellLabelSet
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) { }
Expand Down Expand Up @@ -139,7 +139,7 @@ class ChartCellLabelSet
}

private:
const WordsRange &m_coverage;
const Range &m_coverage;
MapType m_map;
size_t m_size;
};
Expand Down
6 changes: 3 additions & 3 deletions moses/ChartHypothesis.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -52,7 +52,7 @@ class ChartHypothesis

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;
Expand Down Expand Up @@ -100,7 +100,7 @@ class ChartHypothesis
}

//! the source range that this hypothesis spans
const WordsRange &GetCurrSourceRange() const {
const Range &GetCurrSourceRange() const {
return m_currSourceWordsRange;
}

Expand Down
Loading

0 comments on commit 97b2aa5

Please sign in to comment.