Generalized sum rules for the moments of a one-phonon spectral function