Hi Sylvain, I've gone ahead and added the relevant function to WordLattice.h/cpp that should make it a bit easier to construct lattices programmatically. You'll need to encode them in the data type defined in PCNTools.h, which is basically a programmatic representation of the PLF format described in the moses documentation.
The one potential downside is that the edge labels in the PCNTools data type are std::string's, which are converted to Moses's internal integer format. In some cases, this could be a bit slower, but I don't think it will be too inconvenient for most use cases. You can get the code by syncing to the tip of the trunk branch. -Chris On Tue, Jan 25, 2011 at 3:52 PM, Sylvain Raybaud <[email protected]> wrote: > On Tuesday 25 January 2011 14:18:59 Barry Haddow wrote: >> > I don't want to make changes to Moses source code, for the sake of >> > maintainability. I really want to use it as an external library. So, with >> > the above remark, the only option I'm left with is to serialise my >> > lattice and pass it as an istringstream, as you said. The good news is >> > that it probably means less work for me. The bad news is that I'm really >> > not sure about efficiency. But I'll worry about that later. >> >> Hi Sylvain >> >> If you want to add builder methods to WordLattice then you could always >> check them back into moses. >> >> best regards - Barry > > Hi > > I'll think about it. But if I check code into moses, I should maintain it. > This is no problem in the foreseeable future, which in my case goes as far as > two years from now, maximum (end of my phd). What would happen to the code > after? If the code breaks for some reason (changes to the WordLattice or > ConfusionNet classes, for example), any project using it breaks with it, > starting with the one I'm working on :/ > > I'm not really aware of the customs when it comes to moses development, but if > you think the above isn't really a problem, I'll consider implementing and > checking in this builder. Anyway, I will first implement the workaround with > istringstream :) > > best regards, > > > -- > Sylvain Raybaud > _______________________________________________ > 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
