From 47c75319638866609f669346e15663c5ba43af7f Mon Sep 17 00:00:00 2001 From: "adam.d.lopez" Date: Tue, 13 Jul 2010 03:27:59 +0000 Subject: cdec now supports coarse-to-fine decoding (for SCFG only). CTF has several options: -coarse_to_fine_beam_prune= (required to activate CTF) assign an alpha parameter for pruning the coarse foreast -ctf_beam_widen= (optional, defaults to 2.0): ratio to widen coarse pruning beam if fine parse fails. -ctf_num_widenings= (optional, defaults to 2): number of times to widen coarse beam before defaulting to exhaustive source parsing -ctf_no_exhaustive (optional) do not attempt exhaustive parse if CTF fails to find a parse. Additionally, script extools/coarsen_grammar.pl will create a coarse-to-fine grammar (for X?? categories *only*). cdec will read CTF grammars in a format identical to the original, in which refinements of a rule immediately follow the coarse projection, preceded by an additional whitespace character. Not fully tested, but should be backwards compatible. Also not yet integrated into pipelines, but should work on the command line. git-svn-id: https://ws10smt.googlecode.com/svn/trunk@231 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/trule.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'decoder/trule.h') diff --git a/decoder/trule.h b/decoder/trule.h index defdbeb9..3bc96165 100644 --- a/decoder/trule.h +++ b/decoder/trule.h @@ -34,6 +34,9 @@ class TRule { TRule(const std::vector& e, const std::vector& f, const WordID& lhs) : e_(e), f_(f), lhs_(lhs), prev_i(-1), prev_j(-1) {} + TRule(const TRule& other) : + e_(other.e_), f_(other.f_), lhs_(other.lhs_), scores_(other.scores_), arity_(other.arity_), prev_i(-1), prev_j(-1) {} + // deprecated - this will be private soon explicit TRule(const std::string& text, bool strict = false, bool mono = false) : prev_i(-1), prev_j(-1) { ReadFromString(text, strict, mono); @@ -130,6 +133,8 @@ class TRule { SparseVector scores_; char arity_; + + // these attributes are application-specific and should probably be refactored TRulePtr parent_rule_; // usually NULL, except when doing constrained decoding // this is only used when doing synchronous parsing @@ -139,6 +144,9 @@ class TRule { // may be null boost::shared_ptr nt_size_summary_; + // only for coarse-to-fine decoding + boost::shared_ptr > fine_rules_; + private: TRule(const WordID& src, const WordID& trg) : e_(1, trg), f_(1, src), lhs_(), arity_(), prev_i(), prev_j() {} bool SanityCheck() const; -- cgit v1.2.3