It seems that artificial intelligence has a pun and joke-writing branch called computational humor. For instance, a computer software program called Standup:
Though it’s not quite Louis C. K., the Standup program, engineered by a team of computer scientists in Scotland, is one of the more successful efforts to emerge from a branch of artificial intelligence known as computational humor, which seeks to model comedy using machines.
Some Jokes Just Don’t Compute (Limerick)
By Madeleine Begun Kane
Computational humor is here:
Oddball software whose goal’s the frontier
Of punning and jokes.
But so far, I’d say folks
Who are funny have nothing to fear.