Text this: Optimal restoration of stochastic monotonicity with respect to cumulative label frequency loss functions