MCPcopy Create free account
hub / github.com/babel/minify / bwt_transform

Function bwt_transform

scripts/pyflate.py:245–257  ·  view source on GitHub ↗
(L)

Source from the content-addressed store, hash-verified

243 l[:] = l[c:c+1] + l[0:c] + l[c+1:]
244
245def bwt_transform(L):
246 # Semi-inefficient way to get the character counts
247 F = ''.join(sorted(L))
248 base = []
249 for i in range(256):
250 base.append(F.find(chr(i)))
251
252 pointers = [-1] * len(L)
253 for i, char in enumerate(L):
254 symbol = ord(char)
255 pointers[base[symbol]] = i
256 base[symbol] += 1
257 return pointers
258
259def bwt_reverse(L, end):
260 out = []

Callers 1

bwt_reverseFunction · 0.85

Calls 1

lenFunction · 0.85

Tested by

no test coverage detected