1. A method of modeling a source as a generalized context tree and a set of probability distributions conditioned on states of the generalized context tree, comprising: determining a probability assigned to a string x by multiplying a probability of each symbol of the string x conditioned on a corresponding state of the generalized context tree determined by a longest context of the symbol in the string x.