From f9b3b81d7b5a817f39238c1d1fcbaa981d729f4a Mon Sep 17 00:00:00 2001 From: Patrick Simianer
Date: Sun, 4 Sep 2011 23:40:44 +0200
Subject: minor updates, fixes, kbest filtering switch
---
dtrain/kbestget.h | 41 +++++++++++++++++++++++++++++++++++------
1 file changed, 35 insertions(+), 6 deletions(-)
(limited to 'dtrain/kbestget.h')
diff --git a/dtrain/kbestget.h b/dtrain/kbestget.h
index 5247a2be..bb430b85 100644
--- a/dtrain/kbestget.h
+++ b/dtrain/kbestget.h
@@ -24,29 +24,58 @@ struct KBestList {
*/
struct KBestGetter : public DecoderObserver
{
- KBestGetter( const size_t k ) : k_(k) {}
const size_t k_;
+ const string filter_type;
KBestList kb;
+ KBestGetter( const size_t k, const string filter_type ) :
+ k_(k), filter_type(filter_type) {}
+
virtual void
- NotifyTranslationForest(const SentenceMetadata& smeta, Hypergraph* hg)
+ NotifyTranslationForest( const SentenceMetadata& smeta, Hypergraph* hg )
{
- GetKBest(smeta.GetSentenceID(), *hg);
+ KBest( *hg );
}
KBestList* GetKBest() { return &kb; }
void
- GetKBest(int sid, const Hypergraph& forest)
+ KBest( const Hypergraph& forest )
+ {
+ if ( filter_type == "unique" ) {
+ KBestUnique( forest );
+ } else if ( filter_type == "no" ) {
+ KBestNoFilter( forest );
+ }
+ }
+
+ void
+ KBestUnique( const Hypergraph& forest )
{
kb.scores.clear();
kb.sents.clear();
kb.feats.clear();
- // FIXME TODO FIXME TODO
KBest::KBestDerivations