Generating Functions in Neural Learning of Sequential Structures