Refactoring log probability dictionary construction out.