Yes, this shouldn't be too hard. I don't have an existing script to do it, though.
Here is the script that converts Moses to Joshua:
Here is the example from the top of that script:
Joshua:
[PP] ||| der [NN,1] ||| of the [NN,1] ||| .301 .6989
Moses:
der [X][NN] [X] ||| of the [X][NN] [PP] ||| 0-0 0-1 1-2 ||| 0.5 0.2 ||| |||
It shouldn't be hard to invert this. The differences in the formats are:
- Moses does not have an extra field for the lefthand side. Instead, it uses the last token on both the source and target sides to list the left-hand side symbols
- Joshua adopts a convention that requires synchronous nonterminals on the source and target sides to have the same symbol, and then uses a shortcut where you only have to list it once. Moses does not require symbols to match, but instead permits different symbols (note that this doesn't add any formal power). Usually, the source side is all Xs, and the target side reflects any actual syntax.
- Moses takes the log of all dense features; Joshua assumes you have handed it negative log values, and inverts them so that they are regular logs. Joshua also permits labeled features, which it won't convert. I don't know if Moses permits labeled features in the grammar file.
If you write a script, please send it our way so I can include it!
matt