Entropy of first char of a word in dictionary

24 Views Asked by At

Suppose I have an English dictionary, that is a list of words in a file. I have to calculate the entropy of the first char.

I calculated the probability of each first char ($P_a, P_b, \dots, P_z$) in this way:

$$P_a = \dfrac {\# \text{words that start with 'a'}} {\# \text{tot words in dictionary}} .$$

How can I calculate $H(\text{first char})$? I think it's:

$$H(X) = - \sum _{i=a, \dots, z} P_i \log_2 P_i$$

but I'm not sure.

Thanks.