# Calculating the information contained in a message

Lets say i want to calculate the information content of a particular message.What apart from the message itself has to be taken into account in doing so, and what data would i need to collect to perform my action?

-

May be, one needs to estimate the frequency $p(m)$ of occurrence of the message $m$. Then $\log \frac{1}{p(m)}$ is the information content of the message $m$.
 This is a nice answer. The quantity $h(m) = \log 1/p(m)$ can be conceived as the "surprise" of seeing message $m$ (it's a decreasing function of the probability of encountering message $m$ -- if we always observe this message then $p(m)=1$ and surprise $h=0$.). This quantity averaged over the distribution of all messages $p(m)$ is the Shannon entropy. So the surprise of seeing $m$ is the contribution of that message to the total entropy, but it's not really an "information" in the classical sense. – jpillow Jul 7 '11 at 5:33