Hi,

to second Ken: you should implement the function and it should
give an informative error message and exit.

Here is what the lexicalized reordering model does:
 virtual FFState* EvaluateChart(const ChartHypothesis&,
                                 int /* featureID */,

ScoreComponentCollection*) const {
                CHECK(0); // not valid for chart decoder
                return NULL;
        }

which is not entirely informative.

-phi

On Fri, Mar 30, 2012 at 1:55 PM, Kenneth Heafield <[email protected]>wrote:

> 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
>
_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support

Reply via email to