MCPcopy Create free account
hub / github.com/ankane/tokenizers-ruby / test_encode_pair_encoding

Method test_encode_pair_encoding

test/tokenizer_test.rb:92–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90 end
91
92 def test_encode_pair_encoding
93 tokenizer = Tokenizers.from_pretrained("bert-base-cased")
94 question = "Am I allowed to pass two text arguments?"
95 answer = "Yes I am!"
96 encoded = tokenizer.encode(question, answer)
97 expected_tokens = ["[CLS]", "Am", "I", "allowed", "to", "pass", "two", "text", "arguments", "?", "[SEP]", "Yes", "I", "am", "!", "[SEP]"]
98 assert_equal expected_tokens, encoded.tokens
99 end
100
101 def test_encode_pretokenized_encoding
102 tokenizer = Tokenizers.from_pretrained("bert-base-cased")

Callers

nothing calls this directly

Calls 2

from_pretrainedMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected