On 25/11/2015 14:27, [email protected] wrote: > Hi, > > I trained a word by word translation model having this format: > > targetWord | sourceWord | translationProbability There may be something similar in Moses already that you can look at to see how it's implemented moses/FF/WordTranslationFeature.* > > My goal is to add this translation table to Moses as a new feature because > I want to search for target words and their translation probability given > a source sentence words and I want also to tune this model. > > So, I added a new feature class and in the EvaluateWithSourceContext > method, I have the (TargetPhrase &targetPhrase) argument which I think > give me access to the source sentence and the target sentence. > > In order to get access to the words, I tried one draft code like in the > following: > > for(size_t targetIndex = 0; targetIndex < targetPhrase.GetSize(); > targetIndex++ ) > { > const Word& targetWord = targetPhrase.GetWord( targetIndex ); > cerr<< targetWord.GetString(0)<<endl; > } > > The method GetString is defined in the class Word like this > StringPiece GetString (FactorType factorType) const > So it should return the String representation of a Word given a FactorType > as argument. In this code, I specified 0 as argument. But actually, I > don't understand what I have to give as argument because my translation > model is not using any factorType. If I understand well, FactorType is > used when we use factors like part of speech tags and this is not the > case of the translation model I'm using. That should work. If you don't have any factors, you'll be using factor 0. > > My question is can I read the string source and target words without using > Factors? If not, how can I do that, given that my translation model is > just using surface form of words. a (const Factor*) is just the unique vocab id for moses. > > > I hope I'm clear. If not, don't hesitate to tell me that. > I thank you, > Dorra > > >> I'm not sure what you're trying to do. Can you give an example. >> >> >> On 24/11/2015 22:46, [email protected] wrote: >>> Hi, >>> >>> I would like to add a word by word translation model to moses as a new >>> feature. I didn't understand how it is possible to have access to the >>> source and target words. As it is explained in the documentation, >>> StringPiece is accessible by Factor class which is accessible by Word >>> class which is accessible by TargetPhrase which is given as argument in >>> the evaluation method like . I don't use >>> factors >>> with my translation model, I just use surface form of words. >>> How is it possible to read the string source and target words without >>> using Factors? >>> >>> Thank you, >>> Dorra >>> _______________________________________________ >>> Moses-support mailing list >>> [email protected] >>> http://mailman.mit.edu/mailman/listinfo/moses-support >>> >> -- >> Hieu Hoang >> http://www.hoang.co.uk/hieu >> >
-- Hieu Hoang http://www.hoang.co.uk/hieu _______________________________________________ Moses-support mailing list [email protected] http://mailman.mit.edu/mailman/listinfo/moses-support
