Class: JRRToken::Tokenizer
- Inherits:
-
Object
- Object
- JRRToken::Tokenizer
- Defined in:
- lib/j_r_r_token.rb
Overview
This is the main public interface for the gem.
Class Method Summary collapse
-
.count(text, model:) ⇒ Integer
Counts tokens for a given text using a specified model name.
Class Method Details
.count(text, model:) ⇒ Integer
Counts tokens for a given text using a specified model name. The underlying Rust extension will handle mapping the model name to the correct tokenizer.
28 29 30 31 32 |
# File 'lib/j_r_r_token.rb', line 28 def self.count(text, model:) # This calls the `count_tokens` function from our Rust code, # passing both the model and the text. JRRToken.count_tokens(model, text.to_s) end |