Hi Lane,
At least in this case it seems nice to have the compiler make
developers aware that their implementation is incomplete. Ideally the
feature function constructor would indicate the type of model so they
can fail fast, but it also seems a little much.
I'm not entitled to speak authoritatively about error handling in
Moses, but you could throw an exception like
#include "util/exception.hh"
UTIL_THROW(util::Exception, "SyntacticLanguageModel is not defined for
chart-based models.");
That will throw in stuff like line number and function too. If you're
feeling fancy, define your own class for this category of error.
class Unimplemented : public util::Exception {
public:
Unimplemented() throw();
~Unimplemented() throw();
};
Or the good old cerr/abort combo. As long as it's informative. By the
way, can we please fix the segfault when input has an errant | character?
Kenneth
On 03/30/2012 04:15 PM, Lane Schwartz wrote:
> Hi,
>
> I'm attempting to compile the latest moses from git master with my
> syntactic LM enabled.
>
> Last June, Philipp added a virtual function to FeatureFunction.h called
> EvaluateChart.
>
> My feature function is well-defined over phrase-based translation, but
> not for syntactic TMs. But, because my feature inherits from
> FeatureFunction, I have to implement the EvaluateChart method.
>
> How should I handle this? I'm fine with throwing an error here, but how
> do I do that?
>
> Or should there be a default implementation of EvaluateChart in
> FeatureFunction.cpp that either does nothing or throws an error?
>
> Thanks,
> Lane
>
>
>
> _______________________________________________
> Moses-support mailing list
> [email protected]
> http://mailman.mit.edu/mailman/listinfo/moses-support
_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support