Text this: Controlling nonergodicity in quantum many-body systems by reinforcement learning