1. A method, carried out on an electronic computer controlled by instructions of a computer program, for determining a variably sized context model from input signal data having symbols chosen from an alphabet having n symbols {a 1 , a 2 ,. .. , a n }, the method comprising: counting, by the electronic computer, a number of occurrences of metasymbols in the input signal data formed by a context of K symbols and a currently considered symbol; preparing, by the electronic computer, a context tree, each node having n children, the context tree having leaf nodes, each leaf node associated with a particular context derived from a path of edges and nodes leading to the leaf node from a root node of the context tree; pruning, by the electronic computer, the context tree by an ordered sequence of merge operations that each merges the children of a merge-candidate node; and storing, by the electronic computer, the pruned context tree in a computer-readable medium for subsequent use as the variably sized context model in one of a data-compression system, a data-prediction system, a digital-data denoising system, and another such data-processing system that transforms input data to output data using the variably sized context model.