Abstract out Category Weight Function