Hi Amir, I'm implementing a feature function in moses-chart. I need the source words > string and also their indexes in the source sentence. I've written a > function that gets the source words but I don't know how extract word > string from a word. > could anyone guide me how to do that? as I know, each word is implemented > as an array of factors, which of them is its string?
You can utilize some of the following functions to get the source information: //target phrase and range const TargetPhrase& currTargetPhrase = cur_hypo.GetCurrTargetPhrase(); const WordsRange& sourceWordRage = cur_hypo.GetCurrSourceWordsRange(); //source sentence Manager& manager = cur_hypo.GetManager(); const Sentence& source_sent = static_cast<const Sentence&>(manager.GetSource()); //alignment const AlignmentInfo& alignments = targetPhrase.GetAlignTerm(); I have also some questions about the states in the stateful features, > what kind of variables should be stored in each state? only those ones > that should be used in the compare function? or any variable from the > previous hypothesis that we use in our feature? Normally, for stateful functions, for instance, previous target words will be stored. -- Cheers, Vu On Wed, Dec 10, 2014 at 4:11 PM, amir haghighi <amir.haghighi...@gmail.com> wrote: > Hi everyone > > I'm implementing a feature function in moses-chart. I need the source > words string and also their indexes in the source sentence. I've written a > function that gets the source words but I don't know how extract word > string from a word. > could anyone guide me how to do that? as I know, each word is implemented > as an array of factors, which of them is its string? > > I have also some questions about the states in the stateful features, > what kind of variables should be stored in each state? only those ones > that should be used in the compare function? or any variable from the > previous hypothesis that we use in our feature? > > Thanks in advance! > > Cheers > Amir > > _______________________________________________ > Moses-support mailing list > Moses-support@mit.edu > http://mailman.mit.edu/mailman/listinfo/moses-support > >
_______________________________________________ Moses-support mailing list Moses-support@mit.edu http://mailman.mit.edu/mailman/listinfo/moses-support