Text this: Unified regularity measures for sample-wise learning and generalization