MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / encode

Method encode

NLP/UNIMO/src/model/tokenization.py:214–220  ·  view source on GitHub ↗

bpe encoding

(self, text)

Source from the content-addressed store, hash-verified

212 return word
213
214 def encode(self, text):
215 """bpe encoding"""
216 bpe_tokens = []
217 for token in re.findall(self.pat, text):
218 token = ''.join(self.byte_encoder[b] for b in token.encode('utf-8'))
219 bpe_tokens.extend(self.encoder[bpe_token] for bpe_token in self.bpe(token).split(' '))
220 return bpe_tokens
221
222 def decode(self, tokens):
223 """bpe decoding"""

Callers 15

memcopyFunction · 0.45
logFunction · 0.45
printable_textFunction · 0.45
clientthreadFunction · 0.45
parser_char_for_wordFunction · 0.45
conversation_clientFunction · 0.45
predictFunction · 0.45
clientthreadFunction · 0.45
conversation_clientFunction · 0.45
client.pyFile · 0.45
printable_textFunction · 0.45
printable_textFunction · 0.45

Calls 2

bpeMethod · 0.95
extendMethod · 0.80

Tested by 1

test_data_2_evalFunction · 0.36