diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-01-14 14:07:42 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-01-14 14:07:42 +0300 |
commit | 05ead45e71916c5763c5c4b6375e2ca6838f3995 (patch) | |
tree | c279bd4aacfb31758720ffbaf5aaf62022574a52 /moses/PP | |
parent | 91cb549ccf09fc33122f3d531f47c38ad0e99b3d (diff) |
beautify
Diffstat (limited to 'moses/PP')
-rw-r--r-- | moses/PP/CountsPhraseProperty.cpp | 10 | ||||
-rw-r--r-- | moses/PP/CountsPhraseProperty.h | 4 | ||||
-rw-r--r-- | moses/PP/NonTermContextProperty.cpp | 128 | ||||
-rw-r--r-- | moses/PP/NonTermContextProperty.h | 46 | ||||
-rw-r--r-- | moses/PP/OrientationPhraseProperty.cpp | 4 | ||||
-rw-r--r-- | moses/PP/OrientationPhraseProperty.h | 4 | ||||
-rw-r--r-- | moses/PP/PhraseProperty.cpp | 4 | ||||
-rw-r--r-- | moses/PP/PhraseProperty.h | 14 | ||||
-rw-r--r-- | moses/PP/SourceLabelsPhraseProperty.cpp | 60 | ||||
-rw-r--r-- | moses/PP/SourceLabelsPhraseProperty.h | 17 | ||||
-rw-r--r-- | moses/PP/SpanLengthPhraseProperty.cpp | 119 | ||||
-rw-r--r-- | moses/PP/SpanLengthPhraseProperty.h | 22 |
12 files changed, 216 insertions, 216 deletions
diff --git a/moses/PP/CountsPhraseProperty.cpp b/moses/PP/CountsPhraseProperty.cpp index b64366733..00bc08011 100644 --- a/moses/PP/CountsPhraseProperty.cpp +++ b/moses/PP/CountsPhraseProperty.cpp @@ -27,11 +27,11 @@ void CountsPhraseProperty::ProcessValue(const std::string &value) std::ostream& operator<<(std::ostream &out, const CountsPhraseProperty &obj) { - out << "Count property=" - << obj.GetTargetMarginal() << " " - << obj.GetSourceMarginal() << " " - << obj.GetJointCount(); - return out; + out << "Count property=" + << obj.GetTargetMarginal() << " " + << obj.GetSourceMarginal() << " " + << obj.GetJointCount(); + return out; } } // namespace Moses diff --git a/moses/PP/CountsPhraseProperty.h b/moses/PP/CountsPhraseProperty.h index 4f6fbcfa8..7f3137085 100644 --- a/moses/PP/CountsPhraseProperty.h +++ b/moses/PP/CountsPhraseProperty.h @@ -47,9 +47,9 @@ public: return m_jointCount; } - virtual const std::string *GetValueString() const { + virtual const std::string *GetValueString() const { UTIL_THROW2("CountsPhraseProperty: value string not available in this phrase property"); - return NULL; + return NULL; }; protected: diff --git a/moses/PP/NonTermContextProperty.cpp b/moses/PP/NonTermContextProperty.cpp index df5e88d8e..d1ea6a554 100644 --- a/moses/PP/NonTermContextProperty.cpp +++ b/moses/PP/NonTermContextProperty.cpp @@ -14,7 +14,7 @@ NonTermContextProperty::NonTermContextProperty() NonTermContextProperty::~NonTermContextProperty() { - //RemoveAllInColl(m_probStores); + //RemoveAllInColl(m_probStores); } void NonTermContextProperty::ProcessValue(const std::string &value) @@ -29,39 +29,39 @@ void NonTermContextProperty::ProcessValue(const std::string &value) size_t ind = 1; while (ind < toks.size()) { - vector<const Factor *> factors; - - for (size_t nt = 0; nt < numNT; ++nt) { - size_t ntInd = Scan<size_t>(toks[ind]); - assert(nt == ntInd); - ++ind; - - for (size_t contextInd = 0; contextInd < 4; ++contextInd) { - //cerr << "toks[" << ind << "]=" << toks[ind] << endl; - const Factor *factor = fc.AddFactor(toks[ind], false); - factors.push_back(factor); - ++ind; - } - } - - // done with the context. Just get the count and put it all into data structures - // cerr << "count=" << toks[ind] << endl; - float count = Scan<float>(toks[ind]); - ++ind; - - for (size_t i = 0; i < factors.size(); ++i) { - size_t ntInd = i / 4; - size_t contextInd = i % 4; - const Factor *factor = factors[i]; - AddToMap(ntInd, contextInd, factor, count); - } + vector<const Factor *> factors; + + for (size_t nt = 0; nt < numNT; ++nt) { + size_t ntInd = Scan<size_t>(toks[ind]); + assert(nt == ntInd); + ++ind; + + for (size_t contextInd = 0; contextInd < 4; ++contextInd) { + //cerr << "toks[" << ind << "]=" << toks[ind] << endl; + const Factor *factor = fc.AddFactor(toks[ind], false); + factors.push_back(factor); + ++ind; + } + } + + // done with the context. Just get the count and put it all into data structures + // cerr << "count=" << toks[ind] << endl; + float count = Scan<float>(toks[ind]); + ++ind; + + for (size_t i = 0; i < factors.size(); ++i) { + size_t ntInd = i / 4; + size_t contextInd = i % 4; + const Factor *factor = factors[i]; + AddToMap(ntInd, contextInd, factor, count); + } } } void NonTermContextProperty::AddToMap(size_t ntIndex, size_t index, const Factor *factor, float count) { if (ntIndex <= m_probStores.size()) { - m_probStores.resize(ntIndex + 1); + m_probStores.resize(ntIndex + 1); } ProbStore &probStore = m_probStores[ntIndex]; @@ -69,38 +69,37 @@ void NonTermContextProperty::AddToMap(size_t ntIndex, size_t index, const Factor } float NonTermContextProperty::GetProb(size_t ntInd, - size_t contextInd, - const Factor *factor, - float smoothConstant) const + size_t contextInd, + const Factor *factor, + float smoothConstant) const { - UTIL_THROW_IF2(ntInd >= m_probStores.size(), "Invalid nt index=" << ntInd); - const ProbStore &probStore = m_probStores[ntInd]; - float ret = probStore.GetProb(contextInd, factor, smoothConstant); - return ret; + UTIL_THROW_IF2(ntInd >= m_probStores.size(), "Invalid nt index=" << ntInd); + const ProbStore &probStore = m_probStores[ntInd]; + float ret = probStore.GetProb(contextInd, factor, smoothConstant); + return ret; } ////////////////////////////////////////// void NonTermContextProperty::ProbStore::AddToMap(size_t index, const Factor *factor, float count) { - Map &map = m_vec[index]; - - Map::iterator iter = map.find(factor); - if (iter == map.end()) { - map[factor] = count; - } - else { - float &currCount = iter->second; - currCount += count; - } - - m_totalCount += count; + Map &map = m_vec[index]; + + Map::iterator iter = map.find(factor); + if (iter == map.end()) { + map[factor] = count; + } else { + float &currCount = iter->second; + currCount += count; + } + + m_totalCount += count; } float NonTermContextProperty::ProbStore::GetProb(size_t contextInd, - const Factor *factor, - float smoothConstant) const + const Factor *factor, + float smoothConstant) const { float count = GetCount(contextInd, factor, smoothConstant); float total = GetTotalCount(contextInd, smoothConstant); @@ -109,27 +108,26 @@ float NonTermContextProperty::ProbStore::GetProb(size_t contextInd, } float NonTermContextProperty::ProbStore::GetCount(size_t contextInd, - const Factor *factor, - float smoothConstant) const + const Factor *factor, + float smoothConstant) const { - const Map &map = m_vec[contextInd]; - - float count = smoothConstant; - Map::const_iterator iter = map.find(factor); - if (iter == map.end()) { - // nothing - } - else { - count += iter->second; - } - - return count; + const Map &map = m_vec[contextInd]; + + float count = smoothConstant; + Map::const_iterator iter = map.find(factor); + if (iter == map.end()) { + // nothing + } else { + count += iter->second; + } + + return count; } float NonTermContextProperty::ProbStore::GetTotalCount(size_t contextInd, float smoothConstant) const { - const Map &map = m_vec[contextInd]; - return m_totalCount + smoothConstant * map.size(); + const Map &map = m_vec[contextInd]; + return m_totalCount + smoothConstant * map.size(); } diff --git a/moses/PP/NonTermContextProperty.h b/moses/PP/NonTermContextProperty.h index 56db9cb32..efe007099 100644 --- a/moses/PP/NonTermContextProperty.h +++ b/moses/PP/NonTermContextProperty.h @@ -27,38 +27,40 @@ public: }; float GetProb(size_t ntInd, - size_t contextInd, - const Factor *factor, - float smoothConstant) const; + size_t contextInd, + const Factor *factor, + float smoothConstant) const; protected: - class ProbStore { - typedef std::map<const Factor*, float> Map; // map word -> prob - typedef std::vector<Map> Vec; // left outside, left inside, right inside, right outside - Vec m_vec; - float m_totalCount; + class ProbStore + { + typedef std::map<const Factor*, float> Map; // map word -> prob + typedef std::vector<Map> Vec; // left outside, left inside, right inside, right outside + Vec m_vec; + float m_totalCount; - float GetCount(size_t contextInd, - const Factor *factor, - float smoothConstant) const; - float GetTotalCount(size_t contextInd, float smoothConstant) const; + float GetCount(size_t contextInd, + const Factor *factor, + float smoothConstant) const; + float GetTotalCount(size_t contextInd, float smoothConstant) const; public: - ProbStore() - :m_vec(4) - ,m_totalCount(0) - {} + ProbStore() + :m_vec(4) + ,m_totalCount(0) { + } - float GetProb(size_t contextInd, - const Factor *factor, - float smoothConstant) const; + float GetProb(size_t contextInd, + const Factor *factor, + float smoothConstant) const; - float GetSize(size_t index) const - { return m_vec[index].size(); } + float GetSize(size_t index) const { + return m_vec[index].size(); + } - void AddToMap(size_t index, const Factor *factor, float count); + void AddToMap(size_t index, const Factor *factor, float count); }; diff --git a/moses/PP/OrientationPhraseProperty.cpp b/moses/PP/OrientationPhraseProperty.cpp index 1722a5383..4088a0d8b 100644 --- a/moses/PP/OrientationPhraseProperty.cpp +++ b/moses/PP/OrientationPhraseProperty.cpp @@ -7,14 +7,14 @@ namespace Moses void OrientationPhraseProperty::ProcessValue(const std::string &value) { - // bidirectional MSLR phrase orientation with 2x4 orientation classes: + // bidirectional MSLR phrase orientation with 2x4 orientation classes: // mono swap dleft dright std::istringstream tokenizer(value); try { if (! (tokenizer >> m_l2rMonoProbability >> m_l2rSwapProbability >> m_l2rDleftProbability >> m_l2rDrightProbability - >> m_r2lMonoProbability >> m_r2lSwapProbability >> m_r2lDleftProbability >> m_r2lDrightProbability)) { + >> m_r2lMonoProbability >> m_r2lSwapProbability >> m_r2lDleftProbability >> m_r2lDrightProbability)) { UTIL_THROW2("OrientationPhraseProperty: Not able to read value. Flawed property?"); } } catch (const std::exception &e) { diff --git a/moses/PP/OrientationPhraseProperty.h b/moses/PP/OrientationPhraseProperty.h index f6344062c..d682e1c59 100644 --- a/moses/PP/OrientationPhraseProperty.h +++ b/moses/PP/OrientationPhraseProperty.h @@ -58,9 +58,9 @@ public: }; - virtual const std::string *GetValueString() const { + virtual const std::string *GetValueString() const { UTIL_THROW2("OrientationPhraseProperty: value string not available in this phrase property"); - return NULL; + return NULL; }; protected: diff --git a/moses/PP/PhraseProperty.cpp b/moses/PP/PhraseProperty.cpp index 614b39c60..69e3c3374 100644 --- a/moses/PP/PhraseProperty.cpp +++ b/moses/PP/PhraseProperty.cpp @@ -5,8 +5,8 @@ namespace Moses std::ostream& operator<<(std::ostream &out, const PhraseProperty &obj) { - out << "Base phrase property"; - return out; + out << "Base phrase property"; + return out; } } diff --git a/moses/PP/PhraseProperty.h b/moses/PP/PhraseProperty.h index e8127e5bb..76c294481 100644 --- a/moses/PP/PhraseProperty.h +++ b/moses/PP/PhraseProperty.h @@ -14,15 +14,21 @@ class PhraseProperty public: PhraseProperty() : m_value(NULL) {}; - virtual ~PhraseProperty() { if ( m_value != NULL ) delete m_value; }; + virtual ~PhraseProperty() { + if ( m_value != NULL ) delete m_value; + }; - virtual void ProcessValue(const std::string &value) { m_value = new std::string(value); }; + virtual void ProcessValue(const std::string &value) { + m_value = new std::string(value); + }; - virtual const std::string *GetValueString() const { return m_value; }; + virtual const std::string *GetValueString() const { + return m_value; + }; protected: - std::string *m_value; + std::string *m_value; }; diff --git a/moses/PP/SourceLabelsPhraseProperty.cpp b/moses/PP/SourceLabelsPhraseProperty.cpp index 8e6a5dd6d..efe5ae741 100644 --- a/moses/PP/SourceLabelsPhraseProperty.cpp +++ b/moses/PP/SourceLabelsPhraseProperty.cpp @@ -27,53 +27,53 @@ void SourceLabelsPhraseProperty::ProcessValue(const std::string &value) - // read source-labelled rule items + // read source-labelled rule items std::priority_queue<float> ruleLabelledCountsPQ; while (tokenizer.peek() != EOF) { // try { - SourceLabelsPhrasePropertyItem item; - size_t numberOfLHSsGivenRHS = std::numeric_limits<std::size_t>::max(); + SourceLabelsPhrasePropertyItem item; + size_t numberOfLHSsGivenRHS = std::numeric_limits<std::size_t>::max(); - if (m_nNTs == 1) { + if (m_nNTs == 1) { - item.m_sourceLabelsRHSCount = m_totalCount; + item.m_sourceLabelsRHSCount = m_totalCount; - } else { // rule has right-hand side non-terminals, i.e. it's a hierarchical rule + } else { // rule has right-hand side non-terminals, i.e. it's a hierarchical rule - for (size_t i=0; i<m_nNTs-1; ++i) { // RHS source non-terminal labels - size_t sourceLabelRHS; - if (! (tokenizer >> sourceLabelRHS) ) { // RHS source non-terminal label - UTIL_THROW2("SourceLabelsPhraseProperty: Not able to read right-hand side label index. Flawed property? " << value); - } - item.m_sourceLabelsRHS.push_back(sourceLabelRHS); + for (size_t i=0; i<m_nNTs-1; ++i) { // RHS source non-terminal labels + size_t sourceLabelRHS; + if (! (tokenizer >> sourceLabelRHS) ) { // RHS source non-terminal label + UTIL_THROW2("SourceLabelsPhraseProperty: Not able to read right-hand side label index. Flawed property? " << value); } + item.m_sourceLabelsRHS.push_back(sourceLabelRHS); + } - if (! (tokenizer >> item.m_sourceLabelsRHSCount)) { - UTIL_THROW2("SourceLabelsPhraseProperty: Not able to read right-hand side count. Flawed property? " << value); - } + if (! (tokenizer >> item.m_sourceLabelsRHSCount)) { + UTIL_THROW2("SourceLabelsPhraseProperty: Not able to read right-hand side count. Flawed property? " << value); + } - if (! (tokenizer >> numberOfLHSsGivenRHS)) { - UTIL_THROW2("SourceLabelsPhraseProperty: Not able to read number of left-hand sides. Flawed property? " << value); - } + if (! (tokenizer >> numberOfLHSsGivenRHS)) { + UTIL_THROW2("SourceLabelsPhraseProperty: Not able to read number of left-hand sides. Flawed property? " << value); } + } - for (size_t i=0; i<numberOfLHSsGivenRHS && tokenizer.peek()!=EOF; ++i) { // LHS source non-terminal labels seen with this RHS - size_t sourceLabelLHS; - if (! (tokenizer >> sourceLabelLHS)) { // LHS source non-terminal label - UTIL_THROW2("SourceLabelsPhraseProperty: Not able to read left-hand side label index. Flawed property? " << value); - } - float ruleSourceLabelledCount; - if (! (tokenizer >> ruleSourceLabelledCount)) { - UTIL_THROW2("SourceLabelsPhraseProperty: Not able to read count. Flawed property? " << value); - } - item.m_sourceLabelsLHSList.push_back( std::make_pair(sourceLabelLHS,ruleSourceLabelledCount) ); - ruleLabelledCountsPQ.push(ruleSourceLabelledCount); + for (size_t i=0; i<numberOfLHSsGivenRHS && tokenizer.peek()!=EOF; ++i) { // LHS source non-terminal labels seen with this RHS + size_t sourceLabelLHS; + if (! (tokenizer >> sourceLabelLHS)) { // LHS source non-terminal label + UTIL_THROW2("SourceLabelsPhraseProperty: Not able to read left-hand side label index. Flawed property? " << value); } + float ruleSourceLabelledCount; + if (! (tokenizer >> ruleSourceLabelledCount)) { + UTIL_THROW2("SourceLabelsPhraseProperty: Not able to read count. Flawed property? " << value); + } + item.m_sourceLabelsLHSList.push_back( std::make_pair(sourceLabelLHS,ruleSourceLabelledCount) ); + ruleLabelledCountsPQ.push(ruleSourceLabelledCount); + } - m_sourceLabelItems.push_back(item); + m_sourceLabelItems.push_back(item); // } catch (const std::exception &e) { // UTIL_THROW2("SourceLabelsPhraseProperty: Read error. Flawed property?"); diff --git a/moses/PP/SourceLabelsPhraseProperty.h b/moses/PP/SourceLabelsPhraseProperty.h index 39b43ad3e..d9ec82776 100644 --- a/moses/PP/SourceLabelsPhraseProperty.h +++ b/moses/PP/SourceLabelsPhraseProperty.h @@ -9,28 +9,25 @@ namespace Moses { -// Note that we require label tokens (strings) in the corresponding property values of phrase table entries +// Note that we require label tokens (strings) in the corresponding property values of phrase table entries // to be replaced beforehand by indices (size_t) of a label vocabulary. (TODO: change that?) class SourceLabelsPhrasePropertyItem { -friend class SourceLabelsPhraseProperty; + friend class SourceLabelsPhraseProperty; public: SourceLabelsPhrasePropertyItem() {}; - float GetSourceLabelsRHSCount() const - { + float GetSourceLabelsRHSCount() const { return m_sourceLabelsRHSCount; }; - const std::list<size_t> &GetSourceLabelsRHS() const - { + const std::list<size_t> &GetSourceLabelsRHS() const { return m_sourceLabelsRHS; }; - const std::list< std::pair<size_t,float> > &GetSourceLabelsLHSList() const - { + const std::list< std::pair<size_t,float> > &GetSourceLabelsLHSList() const { return m_sourceLabelsLHSList; }; @@ -60,9 +57,9 @@ public: return m_sourceLabelItems; }; - virtual const std::string *GetValueString() const { + virtual const std::string *GetValueString() const { UTIL_THROW2("SourceLabelsPhraseProperty: value string not available in this phrase property"); - return NULL; + return NULL; }; protected: diff --git a/moses/PP/SpanLengthPhraseProperty.cpp b/moses/PP/SpanLengthPhraseProperty.cpp index d45c7b919..3a3fb3586 100644 --- a/moses/PP/SpanLengthPhraseProperty.cpp +++ b/moses/PP/SpanLengthPhraseProperty.cpp @@ -18,22 +18,21 @@ void SpanLengthPhraseProperty::ProcessValue(const std::string &value) set< vector<string> > indices; for (size_t i = 0; i < toks.size(); ++i) { - const string &span = toks[i]; - - // is it a ntIndex,sourceSpan,targetSpan or count ? - vector<string> toks; - Tokenize<string>(toks, span, ","); - UTIL_THROW_IF2(toks.size() != 1 && toks.size() != 3, "Incorrect format for SpanLength: " << span); - - if (toks.size() == 1) { - float count = Scan<float>(toks[0]); - Populate(indices, count); - - indices.clear(); - } - else { - indices.insert(toks); - } + const string &span = toks[i]; + + // is it a ntIndex,sourceSpan,targetSpan or count ? + vector<string> toks; + Tokenize<string>(toks, span, ","); + UTIL_THROW_IF2(toks.size() != 1 && toks.size() != 3, "Incorrect format for SpanLength: " << span); + + if (toks.size() == 1) { + float count = Scan<float>(toks[0]); + Populate(indices, count); + + indices.clear(); + } else { + indices.insert(toks); + } } // totals @@ -45,11 +44,11 @@ void SpanLengthPhraseProperty::Populate(const set< vector<string> > &indices, fl { set< vector<string> >::const_iterator iter; for (iter = indices.begin(); iter != indices.end(); ++iter) { - const vector<string> &toksStr = *iter; - vector<size_t> toks = Scan<size_t>(toksStr); - UTIL_THROW_IF2(toks.size() != 3, "Incorrect format for SpanLength. Size is " << toks.size()); + const vector<string> &toksStr = *iter; + vector<size_t> toks = Scan<size_t>(toksStr); + UTIL_THROW_IF2(toks.size() != 3, "Incorrect format for SpanLength. Size is " << toks.size()); - Populate(toks, count); + Populate(toks, count); } } @@ -59,8 +58,8 @@ void SpanLengthPhraseProperty::Populate(const std::vector<size_t> &toks, float c size_t sourceLength = toks[1]; size_t targetLength = toks[2]; if (ntInd >= m_source.size() ) { - m_source.resize(ntInd + 1); - m_target.resize(ntInd + 1); + m_source.resize(ntInd + 1); + m_target.resize(ntInd + 1); } Map &sourceMap = m_source[ntInd].first; @@ -74,54 +73,52 @@ void SpanLengthPhraseProperty::Populate(Map &map, size_t span, float count) Map::iterator iter; iter = map.find(span); if (iter != map.end()) { - float &value = iter->second; - value += count; - } - else { - map[span] = count; + float &value = iter->second; + value += count; + } else { + map[span] = count; } } void SpanLengthPhraseProperty::CalcTotals(Vec &vec) { - for (size_t i = 0; i < vec.size(); ++i) { - float total = 0; - - const Map &map = vec[i].first; - Map::const_iterator iter; - for (iter = map.begin(); iter != map.end(); ++iter) { - float count = iter->second; - total += count; - } - - vec[i].second = total; - } + for (size_t i = 0; i < vec.size(); ++i) { + float total = 0; + + const Map &map = vec[i].first; + Map::const_iterator iter; + for (iter = map.begin(); iter != map.end(); ++iter) { + float count = iter->second; + total += count; + } + + vec[i].second = total; + } } float SpanLengthPhraseProperty::GetProb(size_t ntInd, size_t sourceWidth, float smoothing) const { - float count; - - const std::pair<Map, float> &data = m_source[ntInd]; - const Map &map = data.first; - - if (map.size() == 0) { - // should this ever be reached? there shouldn't be any span length proprty so FF shouldn't call this - return 1.0f; - } - - Map::const_iterator iter = map.find(sourceWidth); - if (iter == map.end()) { - count = 0; - } - else { - count = iter->second; - } - count += smoothing; - - float total = data.second + smoothing * (float) map.size(); - float ret = count / total; - return ret; + float count; + + const std::pair<Map, float> &data = m_source[ntInd]; + const Map &map = data.first; + + if (map.size() == 0) { + // should this ever be reached? there shouldn't be any span length proprty so FF shouldn't call this + return 1.0f; + } + + Map::const_iterator iter = map.find(sourceWidth); + if (iter == map.end()) { + count = 0; + } else { + count = iter->second; + } + count += smoothing; + + float total = data.second + smoothing * (float) map.size(); + float ret = count / total; + return ret; } } diff --git a/moses/PP/SpanLengthPhraseProperty.h b/moses/PP/SpanLengthPhraseProperty.h index 982c3ca0d..490b7db72 100644 --- a/moses/PP/SpanLengthPhraseProperty.h +++ b/moses/PP/SpanLengthPhraseProperty.h @@ -13,22 +13,22 @@ namespace Moses class SpanLengthPhraseProperty : public PhraseProperty { public: - SpanLengthPhraseProperty(); + SpanLengthPhraseProperty(); - void ProcessValue(const std::string &value); + void ProcessValue(const std::string &value); - float GetProb(size_t ntInd, size_t sourceWidth, float smoothing) const; + float GetProb(size_t ntInd, size_t sourceWidth, float smoothing) const; protected: - // fractional counts - typedef std::map<size_t, float> Map; - typedef std::vector<std::pair<Map, float> > Vec; - Vec m_source, m_target; + // fractional counts + typedef std::map<size_t, float> Map; + typedef std::vector<std::pair<Map, float> > Vec; + Vec m_source, m_target; - void Populate(const std::set< std::vector<std::string> > &indices, float count); - void Populate(const std::vector<size_t> &toks, float count); - void Populate(Map &map, size_t span, float count); + void Populate(const std::set< std::vector<std::string> > &indices, float count); + void Populate(const std::vector<size_t> &toks, float count); + void Populate(Map &map, size_t span, float count); - void CalcTotals(Vec &vec); + void CalcTotals(Vec &vec); }; } // namespace Moses |