Hi Barry,
thank you very much for the quick response. I tried both, in-memory and
on-disk with the same result. The possible fix you propose is a good
point. Thanks for that.
Best
Sascha
Barry Haddow wrote:
> Hi Sascha
>
> Do you know if you're using an in-memory or on-disk phrase table?
>
> I had a quick look at the code, and it looks like the in-memory phrase table
> does not set the source phrase correctly, maybe the on-disk table has the
> same problem.
>
> A possible fix would be to implement a copy constructor for TargetPhrase,
> which makes a deep copy, including its embedded source Phrase. I'd have to do
> a bit more investigation to see if this fix would work, as I'm not so
> familiar with this part of the code.
>
> hope that helps - best regards - Barry
>
>
>
> On Tuesday 08 February 2011 16:51, 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
>> }
>>
>> _______________________________________________
>> Moses-support mailing list
>> [email protected]
>> http://mailman.mit.edu/mailman/listinfo/moses-support
>
--
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