Generation of templates was partially based on the RDChiral package proposed by Coley et al., with several minor differences. The package originally caters to templates for retrosynthesis so it was appropriately adapted for forward reaction prediction in this work. Chirality, number of hydrogens, degree and formal charge were explicitly specified for only functional groups in carrier fragments featured in the template. This is to ensure that templates are applied correctly to query species, but at the same time retain generalizability with respect to the atom environment (that make up the rest of the carrier fragment) around functional groups. Figure provides an example of the template SMARTS following this methodology.