I solved the problem by calling
m_targetPhrase.SetSourcePhrase(m_sourcePhrase);
inside the TranslationOption constructor for
InputType SentenceInput.
Best
Sascha
Sascha Fendrich wrote:
> Hi All,
>
> I have implemented a stateless feature where I need
> access to the string representation of source and
> target phrase within the member function "Evaluate".
> Everything works well for the target phrase, but I
> get a segmentation fault when I call GetStringRep for
> the source phrase (see code example below).
>
> Has anyone some hints about what I'm doing wrong or
> what I should take into account? (I'm working with
> mira-mtm5-branch as codebase for sake of sparse
> features)
>
> Thanks
> Sascha
>
>
> /* minimal code example */
>
> void MyFeature::Evaluate (const TargetPhrase& tp,
> ScoreComponentCollection* score) const
> {
> string trg = tp.GetStringRep(m_factorsToPrint); // works well
> const Phrase *srcPhrase = tp.GetSourcePhrase(); // works well
> string src = srcPhrase->GetStringRep(m_factorsToPrint); // segfault
> }
>
>
--
Sascha Fendrich
Institut für Computerlinguistik
Universität Heidelberg
Im Neuenheimer Feld 325, Raum 108
69120 Heidelberg, Germany
Mail: [email protected]
Tel.: +49-6221-543252
_______________________________________________
Moses-support mailing list
[email protected]
http://mailman.mit.edu/mailman/listinfo/moses-support