Context-based Text Predictive transform

Vicente González Ruiz

December 31, 2019

Contents

1 Preamble
2 0-order encoder
 2.1 Example
3 0-order decoder
 3.1 Example
4 N-order encoder
 4.1 Example (k = 1)
5 N-order decoder
 5.1 Example
References

1 Preamble

2 0-order encoder

  1. The step 1 of the MTF transform, although now there is a counter for every node in the list.
  2. While the input is not exhausted:
    1. s next input symbol.
    2. c position of s in L (the prediction error).
    3. Output c.
    4. Update the count of L[c] (the count of s) and keep sorted L.

2.1 Example

3 0-order decoder

  1. The step 1 of the encoder.
  2. While the input is not exhausted:
    1. c next input code.
    2. s L[c].
    3. Output s.
    4. Step 2.D of the encoder.

3.1 Example

TO-DO

4 N-order encoder

  1. Let 𝒞[i] the context of a input symbol s and L𝒞[i] the list previous simbols for that context. If i > 0 then the lists are empty, else, the list is fully populated and the count of every node is 0.
  2. Let k the order of the prediction.
  3. Let H = a list of tested symbols. All symbols in H must be different.
  4. While the input is not exhausted:
    1. s the next input symbol.
    2. i k (except for the first symbol, where i 0).
    3. While sL𝒞[i]:
      1. H reduce(H L𝒞[i]). # reduce() deletes the repeated nodes.
      2. Update the count of s in L𝒞[i] and keep sorted it.
      3. i i 1.
    4. Let c the position of s en L𝒞[i].
    5. c c+ symbols of H L𝒞[i]. So, the decoder will know the length of the context where s happens and does not count the same symbol twice.
    6. Output c.
    7. Update the count of s in L𝒞[i] and keep sorted it.
    8. H .

4.1 Example (k = 1)

5 N-order decoder

  1. Steps 1, 2 and 3 of the encoder.
  2. While the input is not exhausted:
    1. c the next input code.
    2. i k (except for the first symbol, where i 0).
    3. While L𝒞[i] = :
      1. H reduce(H L𝒞[i]).
      2. i i 1.
    4. s reduce(H L𝒞[i]).
    5. Update the count of L𝒞[i].
    6. While i < k:
      1. i i + 1.
      2. Insert the symbol s in L𝒞[i].

5.1 Example

TO-DO