Language models can learn complex molecular distributions