Constructing a Flexible Likelihood Function for Spectroscopic Inference