adapted for custom per-word smoothing hyperparameter