[irstlm] 16/126: changes to context-dependent LM
Giulio Paci
giuliopaci-guest at moszumanska.debian.org
Tue May 17 07:46:40 UTC 2016
This is an automated email from the git hooks/post-receive script.
giuliopaci-guest pushed a commit to annotated tag adaptiveLM.v0.1
in repository irstlm.
commit 6dbcfb5a690b82fc1fb69e46bc8ee0f6cea2abe2
Author: Nicola Bertoldi <bertoldi at fbk.eu>
Date: Tue Jul 21 16:28:31 2015 +0200
changes to context-dependent LM
---
src/lmContextDependent.cpp | 15 ++++++++++-----
src/lmContextDependent.h | 1 +
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/lmContextDependent.cpp b/src/lmContextDependent.cpp
index d4004a4..d47b655 100644
--- a/src/lmContextDependent.cpp
+++ b/src/lmContextDependent.cpp
@@ -127,18 +127,23 @@ void lmContextDependent::load(const std::string &filename,int mmap)
inp.close();
}
+double lmContextDependent::lprob(ngram ng, topic_map& topic_weights, double* bow,int* bol,char** maxsuffptr,unsigned int* statesize,bool* extendible)
+{
+ double lm_prob = m_lm->clprob(ng, bow, bol, maxsuffptr, statesize, extendible);
+ double topic_prob = 0.0; // to_CHECK
+ double ret_prob = m_lm_weight * lm_prob + m_topicmodel_weight * topic_prob;
+
+ return ret_prob;
+}
+
double lmContextDependent::lprob(int* codes, int sz, topic_map& topic_weights, double* bow,int* bol,char** maxsuffptr,unsigned int* statesize,bool* extendible)
{
//create the actual ngram
ngram ong(dict);
ong.pushc(codes,sz);
MY_ASSERT (ong.size == sz);
-
- double lm_prob = m_lm->clprob(ong, bow, bol, maxsuffptr, statesize, extendible);
- double topic_prob = 0.0; // to_CHECK
- double ret_prob = m_lm_weight * lm_prob + m_topicmodel_weight * topic_prob;
- return clprob(ong, bow, bol, maxsuffptr, statesize, extendible);
+ return lprob(ong, topic_weights, bow, bol, maxsuffptr, statesize, extendible);
}
double lmContextDependent::setlogOOVpenalty(int dub)
diff --git a/src/lmContextDependent.h b/src/lmContextDependent.h
index 418fe70..7795aa6 100644
--- a/src/lmContextDependent.h
+++ b/src/lmContextDependent.h
@@ -91,6 +91,7 @@ public:
return lprob(ng, ngsize, topic_weights, bow, bol, maxsuffptr, statesize, extendible);
};
virtual double lprob(int* ng, int ngsize, topic_map& topic_weights, double* bow=NULL,int* bol=NULL,char** maxsuffptr=NULL,unsigned int* statesize=NULL,bool* extendible=NULL);
+ virtual double lprob(ngram ng, topic_map& topic_weights, double* bow=NULL,int* bol=NULL,char** maxsuffptr=NULL,unsigned int* statesize=NULL,bool* extendible=NULL);
int maxlevel() const {
return maxlev;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/irstlm.git
More information about the debian-science-commits
mailing list