{'fraction_non_alphanumeric': 0.02545743834526651, 'fraction_numerical': 0.006364359586316627, 'mean_word_length': 4.906103286384977, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Tunstall adaptive coding and miscoding

In the first part of this paper, we tackle the case where a variable length-to-block Tunstall code is used to encode the wrong source (miscoding). It turns out that, exactly as happens in the case with Huffman coding, the asymptotic excess rate is given by the informational divergence between the probability distribution ruling the source and the probability distribution for which the Tunstall code had been devised. We also prove asymptotic equality between the individual rate of a codeword and the corresponding self-information. This allows us to bound the maximal and the minimal length in a Tunstall tree. In the second part of the paper we study the case where the probability distribution of the source changes in time. If this happens, it is necessary to frequently update the current code, to ensure that the optimality conditions concerning its rate are met. This coding procedure is known as adaptive coding. We propose some schemes for adaptive Tunstall coding, based on the structure of the coding tree, on the "ordering property", analogous to Gallager's (1978) sibling property of the Huffman code, and on the "Tunstall regions", analogous to the attraction regions due to Longo and Galasso (1982).