Overview
| Comment: | a testable bpe implementation that encodes and decodes in a single execution |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | bpe |
| Files: | files | file ages | folders |
| SHA1: |
a06f897887882bb945b3ab8927f72841 |
| User & Date: | spaskalev on 2014-12-28 15:54:10.422 |
| Other Links: | branch diff | manifest | tags |
Context
|
2014-12-28
| ||
| 17:16 | Closing the branch, this particular implementation is unfruitfull :) Closed-Leaf check-in: 4fe28f11ac user: spaskalev tags: bpe | |
| 15:54 | a testable bpe implementation that encodes and decodes in a single execution check-in: a06f897887 user: spaskalev tags: bpe | |
| 15:21 | bpe encoding flow implementation check-in: 7733ef9df8 user: spaskalev tags: bpe | |
Changes
Modified src/0dev.org/commands/short/main.go
from [c980bb124e]
to [0cc7fcc383].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | + |
package main
import (
iou "0dev.org/ioutil"
"fmt"
"io"
// "io/ioutil"
"bytes"
"os"
"sort"
)
func main() {
f, err := os.Open(os.Args[1])
if err != nil {
|
| ︙ | |||
27 28 29 30 31 32 33 | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | + - - - - - + + + + + + - - - + + + + + + + + - - - + + + + + + + + + + + + + + + + |
reader, err := apply(rec, f)
if err != nil {
os.Stderr.WriteString("Error while constructing application reader. " + err.Error())
os.Exit(1)
}
var buf bytes.Buffer
|
| ︙ | |||
115 116 117 118 119 120 121 | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | - + |
rec.p2s = make(map[uint16]byte) // Store pair to symbol mappings
rec.s2p = make(map[byte]uint16) // Store symbol to pair mappings
for i, pairsLength := 0, len(pairs); i < pairsLength; i++ {
currentPair := pairs[i]
// Termination condition for when we are out of symbols
|
| ︙ | |||
148 149 150 151 152 153 154 | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | - | pairsLength-- // Mark the current pair for replacement by the current symbol rec.p2s[currentPair.value] = currentSymbol.value } symbols = symbols[1:] } |
| ︙ |