A method for compressing an input string of symbols comprising the steps of: searching an encoder dictionary for each symbol received in the input string, the symbol width being selected dependent on a type of data in the input string; and upon detecting the symbol is not stored in the encoder dictionary, learning the symbol by storing the symbol at a next sequential index in the encoder dictionary and transmitting the symbol in a code word to a decoder; upon detecting that the symbol is stored in the dictionary: concatenating the symbol with a next symbol in the input string until the concatenated symbols are not found in the encoder dictionary, transmitting in the code word an index at which a longest prefix match, identified by the concatenating, is stored in the encoder dictionary, and learning the concatenated symbols, not found in the encoder dictionary, by storing the concatenated symbols in the encoder dictionary; wherein the code word includes a prefix field identifying the contents of the code word, a state of the prefix field indicating whether the code word is a plain symbol to be learned or is an index, the method further comprising: upon detecting a compression ratio based on the current symbol width is low relative to a threshold which determines the compression ratio at which to change the width, modifying the symbol width and communicating a new symbol width to the decoder in order to increase the compression ratio. searching an encoder dictionary for each symbol received in the input string, the symbol width being selected dependent on a type of data in the input string; and upon detecting the symbol is not stored in the encoder dictionary, learning the symbol by storing the symbol at a next sequential index in the encoder dictionary and transmitting the symbol in a code word to a decoder; upon detecting that the symbol is stored in the dictionary: concatenating the symbol with a next symbol in the input string until the concatenated symbols are not found in the encoder dictionary, transmitting in the code word an index at which a longest prefix match, identified by the concatenating, is stored in the encoder dictionary, and learning the concatenated symbols, not found in the encoder dictionary, by storing the concatenated symbols in the encoder dictionary; concatenating the symbol with a next symbol in the input string until the concatenated symbols are not found in the encoder dictionary, transmitting in the code word an index at which a longest prefix match, identified by the concatenating, is stored in the encoder dictionary, and learning the concatenated symbols, not found in the encoder dictionary, by storing the concatenated symbols in the encoder dictionary; wherein the code word includes a prefix field identifying the contents of the code word, a state of the prefix field indicating whether the code word is a plain symbol to be learned or is an index, the method further comprising: upon detecting a compression ratio based on the current symbol width is low relative to a threshold which determines the compression ratio at which to change the width, modifying the symbol width and communicating a new symbol width to the decoder in order to increase the compression ratio.