tokenizers 0.2.2-aarch64-linux → 0.2.3-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6eb598afb972974b72da4aabbfb72ecac6470f62e620ad4ee0cefb4aaa403173
4
- data.tar.gz: a469da134839a57c31326c13721cb0f1fb34408b8b3a18a6cd16dde1b331c1a4
3
+ metadata.gz: 8ebac1b83e37b024ec99ac2e96b1085bdbdd060207b53a0d5411f826c15e7a05
4
+ data.tar.gz: 1278eb2b6c661f441f65eb53a28595690c51b532a5e468b606ad75fa57aaecba
5
5
  SHA512:
6
- metadata.gz: 5f78428fae46491dc2414a047ee6381cb787cffe17c59ba317e48453c62e2c809abfeae7e126271f778e893aaa7a4b9ed3b90ab9fe46bec17b0392befef5d0fe
7
- data.tar.gz: 6613e888311b6630a0c6ced1ba353cd5eb2c7b33ddc00c7476896c78cfe71d44d5634adb401457995d06d86d476553a343db0ae597f18c611e180c8406b9f0de
6
+ metadata.gz: 6ddca76a32fdf761150981de37a876b4f3b20283f77fd3b1adb0dbfb3be52af7d95d4ed6d883c7ed98cf4fd6ce32ea50f2396781400ab7071d84b340dc8ccbd2
7
+ data.tar.gz: 0a53cb1b001870aae8fbfdfcf6e93fc83ec19543327338764c2d8bd4af4d2ec8620dfe1b8f5e1f83bf0a45fe123e7973664c86650622e99ecd01839b0da6a450
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.2.3 (2022-01-22)
2
+
3
+ - Added `add_special_tokens` option to `encode` method
4
+ - Added warning about `encode` method including special tokens by default in 0.3.0
5
+ - Added more methods to `Encoding`
6
+ - Fixed error with precompiled gem on Mac ARM
7
+
1
8
  ## 0.2.2 (2022-01-15)
2
9
 
3
10
  - Added precompiled gem for Linux ARM
data/Cargo.lock CHANGED
@@ -753,7 +753,7 @@ dependencies = [
753
753
 
754
754
  [[package]]
755
755
  name = "tokenizers"
756
- version = "0.2.2"
756
+ version = "0.2.3"
757
757
  dependencies = [
758
758
  "magnus",
759
759
  "tokenizers 0.13.2",
@@ -12446,6 +12446,32 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
12446
12446
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
12447
12447
  SOFTWARE.
12448
12448
 
12449
+ ================================================================================
12450
+ rb-sys-env LICENSE-MIT
12451
+ ================================================================================
12452
+
12453
+ The MIT License (MIT)
12454
+
12455
+ Copyright (c) 2021-2022 Ian Ker-Seymer
12456
+
12457
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12458
+ of this software and associated documentation files (the "Software"), to deal
12459
+ in the Software without restriction, including without limitation the rights
12460
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12461
+ copies of the Software, and to permit persons to whom the Software is
12462
+ furnished to do so, subject to the following conditions:
12463
+
12464
+ The above copyright notice and this permission notice shall be included in all
12465
+ copies or substantial portions of the Software.
12466
+
12467
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12468
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12469
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
12470
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12471
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
12472
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
12473
+ SOFTWARE.
12474
+
12449
12475
  ================================================================================
12450
12476
  rb-sys-env LICENSE-APACHE
12451
12477
  ================================================================================
@@ -12641,32 +12667,6 @@ rb-sys-env LICENSE-APACHE
12641
12667
  See the License for the specific language governing permissions and
12642
12668
  limitations under the License.
12643
12669
 
12644
- ================================================================================
12645
- rb-sys-env LICENSE-MIT
12646
- ================================================================================
12647
-
12648
- The MIT License (MIT)
12649
-
12650
- Copyright (c) 2021-2022 Ian Ker-Seymer
12651
-
12652
- Permission is hereby granted, free of charge, to any person obtaining a copy
12653
- of this software and associated documentation files (the "Software"), to deal
12654
- in the Software without restriction, including without limitation the rights
12655
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12656
- copies of the Software, and to permit persons to whom the Software is
12657
- furnished to do so, subject to the following conditions:
12658
-
12659
- The above copyright notice and this permission notice shall be included in all
12660
- copies or substantial portions of the Software.
12661
-
12662
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12663
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
12664
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
12665
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
12666
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
12667
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
12668
- SOFTWARE.
12669
-
12670
12670
  ================================================================================
12671
12671
  regex LICENSE-APACHE
12672
12672
  ================================================================================
Binary file
Binary file
Binary file
Binary file
@@ -8,8 +8,8 @@ module Tokenizers
8
8
  @tokenizer.decoder = BPEDecoder.new
9
9
  end
10
10
 
11
- def encode(text)
12
- @tokenizer.encode(text)
11
+ def encode(text, **options)
12
+ @tokenizer.encode(text, **options)
13
13
  end
14
14
 
15
15
  def decode(ids)
@@ -0,0 +1,19 @@
1
+ module Tokenizers
2
+ class Encoding
3
+ def word_to_tokens(word_index, sequence_index = 0)
4
+ _word_to_tokens(word_index, sequence_index)
5
+ end
6
+
7
+ def word_to_chars(word_index, sequence_index = 0)
8
+ _word_to_chars(word_index, sequence_index)
9
+ end
10
+
11
+ def char_to_token(char_pos, sequence_index = 0)
12
+ _char_to_token(char_pos, sequence_index)
13
+ end
14
+
15
+ def char_to_word(char_pos, sequence_index = 0)
16
+ _char_to_word(word_index, sequence_index)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,12 @@
1
+ module Tokenizers
2
+ class Tokenizer
3
+ # TODO change add_special_tokens default to true in 0.3.0
4
+ def encode(sequence, add_special_tokens: nil)
5
+ if add_special_tokens.nil?
6
+ warn "[tokenizers] add_special_tokens will default to true in 0.3.0. Pass add_special_tokens: true/false to silence this warning."
7
+ add_special_tokens = false
8
+ end
9
+ _encode(sequence, add_special_tokens)
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Tokenizers
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/lib/tokenizers.rb CHANGED
@@ -1,14 +1,16 @@
1
1
  # ext
2
2
  begin
3
- require "tokenizers/#{RUBY_VERSION.to_f}/tokenizers"
3
+ require_relative "tokenizers/#{RUBY_VERSION.to_f}/tokenizers"
4
4
  rescue LoadError
5
- require "tokenizers/tokenizers"
5
+ require_relative "tokenizers/tokenizers"
6
6
  end
7
7
 
8
8
  # modules
9
- require "tokenizers/char_bpe_tokenizer"
10
- require "tokenizers/from_pretrained"
11
- require "tokenizers/version"
9
+ require_relative "tokenizers/char_bpe_tokenizer"
10
+ require_relative "tokenizers/encoding"
11
+ require_relative "tokenizers/from_pretrained"
12
+ require_relative "tokenizers/tokenizer"
13
+ require_relative "tokenizers/version"
12
14
 
13
15
  module Tokenizers
14
16
  class Error < StandardError; end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tokenizers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-15 00:00:00.000000000 Z
11
+ date: 2023-01-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: andrew@ankane.org
@@ -28,7 +28,9 @@ files:
28
28
  - lib/tokenizers/3.1/tokenizers.so
29
29
  - lib/tokenizers/3.2/tokenizers.so
30
30
  - lib/tokenizers/char_bpe_tokenizer.rb
31
+ - lib/tokenizers/encoding.rb
31
32
  - lib/tokenizers/from_pretrained.rb
33
+ - lib/tokenizers/tokenizer.rb
32
34
  - lib/tokenizers/version.rb
33
35
  homepage: https://github.com/ankane/tokenizers-ruby
34
36
  licenses:
@@ -52,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
54
  - !ruby/object:Gem::Version
53
55
  version: '0'
54
56
  requirements: []
55
- rubygems_version: 3.4.3
57
+ rubygems_version: 3.4.4
56
58
  signing_key:
57
59
  specification_version: 4
58
60
  summary: Fast state-of-the-art tokenizers for Ruby