MCPcopy Create free account
hub / github.com/PKU-YuanGroup/TaxDiff / encode

Method encode

data_reader/decoder.py:28–32  ·  view source on GitHub ↗

encode a byte string into alphabet indices

(self, x)

Source from the content-addressed store, hash-verified

26 return chr(self.chars[i])
27
28 def encode(self, x):
29 """ encode a byte string into alphabet indices """
30 x = np.frombuffer(x, dtype=np.uint8)
31 x = self.encoding[x]
32 return x
33
34 def decode(self, x):
35 """ decode index array, x, to byte string of this alphabet """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected