summaryrefslogtreecommitdiff
path: root/gi/pyp-topics/src/pyp-topics.hh
diff options
context:
space:
mode:
authorphilblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-06-28 15:01:17 +0000
committerphilblunsom@gmail.com <philblunsom@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-06-28 15:01:17 +0000
commit1070f63e3978b9b26df46ad80fe1f40f2ce83a23 (patch)
treef87f4ddfec6fa1a98d03988bdf6f5d4a372f2cc9 /gi/pyp-topics/src/pyp-topics.hh
parentf7e25929adebd260f7e7d0bf12e05a37abbe1779 (diff)
Added contexts_corpus for reading text data files.
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@36 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/pyp-topics/src/pyp-topics.hh')
-rw-r--r--gi/pyp-topics/src/pyp-topics.hh7
1 files changed, 5 insertions, 2 deletions
diff --git a/gi/pyp-topics/src/pyp-topics.hh b/gi/pyp-topics/src/pyp-topics.hh
index 4036985a..92d6f292 100644
--- a/gi/pyp-topics/src/pyp-topics.hh
+++ b/gi/pyp-topics/src/pyp-topics.hh
@@ -15,7 +15,7 @@ public:
typedef long double F;
public:
- PYPTopics(int num_topics) : m_num_topics(num_topics), m_word_pyps(1), m_backoff(0) {}
+ PYPTopics(int num_topics) : m_num_topics(num_topics), m_word_pyps(1) {}
void sample(const Corpus& corpus, int samples);
int sample(const DocumentId& doc, const Term& term);
@@ -27,6 +27,9 @@ public:
m_word_pyps.clear();
m_word_pyps.resize(m_backoff->order(), PYPs());
}
+ void set_backoff(TermBackoffPtr backoff) {
+ m_backoff = backoff;
+ }
F prob(const Term& term, int topic, int level=0) const;
void decrement(const Term& term, int topic, int level=0);
@@ -46,7 +49,7 @@ private:
PYPs m_document_pyps;
std::vector<PYPs> m_word_pyps;
- std::auto_ptr<TermBackoff> m_backoff;
+ TermBackoffPtr m_backoff;
};
#endif // PYP_TOPICS_HH