-
Notifications
You must be signed in to change notification settings - Fork 6
Glue grammar
A glue grammar is a very small additional grammar that an MT decoder sometimes uses. If no good rule can be applied (like a rule from the main grammar), a glue rule can be used to simply put together two subtrees monotonically. For example, for use with Hiero, the glue rules look like this:
[S] ||| [X,1] ||| [X,1] ||| features
[S] ||| [S,1] [X,2] ||| [S,1] [X,2] ||| features
In a more complex grammar like SAMT, there are more glue rules (two rules like the above for each nonterminal present in the grammar).
Thrax has a built-in utility to create a glue grammar for you. In the above example, the goal symbol is S
, but if you want some other symbol, you can set the goal-symbol
key in your thrax.conf file. There's also a glue rule indicator feature (glue-rule
in the features key of the conf file) that will automatically be set to 0 for the main grammar and 1 for each rule in the glue grammar. This can help your decoder learn how much to use glue rules.
To create the glue grammar, type
$THRAX/scripts/create_glue_grammar.sh <conf file> <grammar >glue.grammar
As you see, the utility reads the main grammar from stdin and prints the glue grammar to stdout.