Generalization of the Partitioning of Shannon Diversity