Is Huffman encoding for the entire language or the body of text?
The statistics used to derive the Huffman codes from can come from any source that you want. For a practical example, the popular DEFLATE format allows both &quot;dynamic Huffman codes&quot; (in this usage it is not a form of adaptive Huffman coding, it means the codebook is specified in the data stream) and &quot;fixed Huffman codes&quot; (a codebook that is specified in the DEFLATE specification).
A codebook based on the statistics of the actual data being compressed generally results in a smaller compressed size. The trade-off is that a codebook that is not pre-defined must be supplied along with the data (the decoder still needs it), adding to the overall size. Canonical Huffman codes can mitigate the impact (requiring only the code lengths to be transmitted, the codes themselves can be inferred in a simple way), but transmitting the codebook is going to cost some extra data, and may not be worth the size overhead for short texts (especially when the statistics of the given text happen to approximately line up with the statistics on which the pre-defined codebook was based).
Other practical considerations may favour using slightly inaccurate statistics, for example statistics based on some prefix of the data to be able to start encoding without having to wait until the input is fully known. The more accurate you want the statistics to be, the longer the latency is between the &quot;first input&quot; and the &quot;first output&quot; of the encoder. Even if the input is entirely known at the start, depending on the application, gathering fully accurate statistics may not be worth the time investment.