summaryrefslogtreecommitdiff
path: root/gi/pf
diff options
context:
space:
mode:
Diffstat (limited to 'gi/pf')
-rw-r--r--gi/pf/align-lexonly.cc6
-rw-r--r--gi/pf/base_measures.h11
2 files changed, 15 insertions, 2 deletions
diff --git a/gi/pf/align-lexonly.cc b/gi/pf/align-lexonly.cc
index 7e48b25a..e9f1e7b6 100644
--- a/gi/pf/align-lexonly.cc
+++ b/gi/pf/align-lexonly.cc
@@ -117,10 +117,12 @@ struct HierarchicalWordBase {
struct BasicLexicalAlignment {
explicit BasicLexicalAlignment(const vector<vector<WordID> >& lets,
+ const unsigned words_e,
const unsigned letters_e,
vector<AlignedSentencePair>* corp) :
letters(lets),
corpus(*corp),
+ //up0(words_e),
//up0("en.chars.1gram", letters_e),
//up0("en.words.1gram"),
up0(letters_e),
@@ -302,11 +304,11 @@ int main(int argc, char** argv) {
ExtractLetters(vocabf, &letters, NULL);
letters[TD::Convert("NULL")].clear();
- BasicLexicalAlignment x(letters, letset.size(), &corpus);
+ BasicLexicalAlignment x(letters, vocabe.size(), letset.size(), &corpus);
x.InitializeRandom();
const unsigned samples = conf["samples"].as<unsigned>();
for (int i = 0; i < samples; ++i) {
- for (int j = 431; j < 433; ++j) Debug(corpus[j]);
+ for (int j = 4995; j < 4997; ++j) Debug(corpus[j]);
cerr << i << "\t" << x.tmodel.r.size() << "\t";
if (i % 10 == 0) x.ResampleHyperparemeters();
x.ResampleCorpus();
diff --git a/gi/pf/base_measures.h b/gi/pf/base_measures.h
index fbd1c3ad..a4e9ac28 100644
--- a/gi/pf/base_measures.h
+++ b/gi/pf/base_measures.h
@@ -11,6 +11,7 @@
#include "trule.h"
#include "prob.h"
#include "tdict.h"
+#include "sampler.h"
inline double log_poisson(unsigned x, const double& lambda) {
assert(lambda > 0.0);
@@ -55,6 +56,11 @@ struct CompletelyUniformBase {
prob_t operator()(const TRule&) const {
return kUNIFORM;
}
+ void Summary() const {}
+ void ResampleHyperparameters(MT19937*) {}
+ void Increment(const TRule&) {}
+ void Decrement(const TRule&) {}
+ prob_t Likelihood() const { return prob_t::One(); }
const prob_t kUNIFORM;
};
@@ -79,6 +85,11 @@ struct PhraseConditionalUninformativeBase {
prob_t p0(const std::vector<WordID>& vsrc, const std::vector<WordID>& vtrg, int start_src, int start_trg) const;
+ void Summary() const {}
+ void ResampleHyperparameters(MT19937*) {}
+ void Increment(const TRule&) {}
+ void Decrement(const TRule&) {}
+ prob_t Likelihood() const { return prob_t::One(); }
const prob_t kUNIFORM_TARGET;
};