They don’t…. The only prominent examples we have of “robojournalism” today areand , which use data. The algorithms for their Wordsmith and Quill platforms are proprietary; however, such natural language generation has been achieved in the past using various template methods.
Modern statistical natural language processing often uses probabilistic algorithms to surface most likely candidates. (One could even think of each layer of a deep neural network as a kind of virtual template; though, I have seen no indication these companies rely on neural networks for “robojournalism”.)