Text this: Automated stopping criterion for spectral measurements with active learning