Template Constrained Decoding