summaryrefslogtreecommitdiff
path: root/gi/pyp-topics/src/pyp-topics.cc
diff options
context:
space:
mode:
authorphilblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-15 16:05:34 +0000
committerphilblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-15 16:05:34 +0000
commitc43ff04b15243a542825104e7d565ac0e7c9ebbd (patch)
tree8ae72ac9bd5227a76e0391a51538bbd56d3f99d5 /gi/pyp-topics/src/pyp-topics.cc
parentd038a7e40a86f949a3d4c51de785505fe1e9286a (diff)
Fixed rather large bug in the table handling for the hierarchical models.
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@265 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/pyp-topics/src/pyp-topics.cc')
-rw-r--r--gi/pyp-topics/src/pyp-topics.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/gi/pyp-topics/src/pyp-topics.cc b/gi/pyp-topics/src/pyp-topics.cc
index 2cc1fc79..b154f922 100644
--- a/gi/pyp-topics/src/pyp-topics.cc
+++ b/gi/pyp-topics/src/pyp-topics.cc
@@ -259,8 +259,8 @@ PYPTopics::F PYPTopics::hresample_topics()
void PYPTopics::decrement(const Term& term, int topic, int level) {
//std::cerr << "PYPTopics::decrement(" << term << "," << topic << "," << level << ")" << std::endl;
- m_word_pyps.at(level).at(topic).decrement(term);
- if (m_backoff.get()) {
+ int table_delta = m_word_pyps.at(level).at(topic).decrement(term);
+ if (table_delta && m_backoff.get()) {
Term backoff_term = (*m_backoff)[term];
if (!m_backoff->is_null(backoff_term))
decrement(backoff_term, topic, level+1);
@@ -269,9 +269,9 @@ void PYPTopics::decrement(const Term& term, int topic, int level) {
void PYPTopics::increment(const Term& term, int topic, int level) {
//std::cerr << "PYPTopics::increment(" << term << "," << topic << "," << level << ")" << std::endl;
- m_word_pyps.at(level).at(topic).increment(term, word_pyps_p0(term, topic, level));
+ int table_delta = m_word_pyps.at(level).at(topic).increment(term, word_pyps_p0(term, topic, level));
- if (m_backoff.get()) {
+ if (table_delta && m_backoff.get()) {
Term backoff_term = (*m_backoff)[term];
if (!m_backoff->is_null(backoff_term))
increment(backoff_term, topic, level+1);