kiribi 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 803db1fd00d13ac7c19283f6dde70de2c455f3974f9869f3a2a18f731b76f5fa
4
+ data.tar.gz: ac418dc0a833f8c8b0ebd0d10637b3c19d0c42a1585e99ca1fb9738ebb96ab20
5
+ SHA512:
6
+ metadata.gz: 5fd259bdbdd994123156dbdd74dc6847fea3b0aa3abe2317b826bb51a8c01c26d8698610b1654e3003b84f6ab1f45583271a16c146db795184b6e1a5660c8b41
7
+ data.tar.gz: 0505e1fe079b5780be611db61c0f54fd87f62358b2c0ae26412fdaa52b3f229f1e3b249bc08f2ea768295e725bcf098ad3867c56634f4cab1dfda1d06ed9db36
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Katsutoshi Fujihara
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kiribi
4
+ VERSION = "0.0.1"
5
+ end
data/lib/kiribi.rb ADDED
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "kiribi/version"
4
+
5
+ module Kiribi
6
+ module Loader
7
+ def self.registry
8
+ @registry ||= []
9
+ end
10
+
11
+ def current_path
12
+ caller = (instance_of?(Module) || instance_of?(Class)) ? self : self.class
13
+ caller.name.split("::")
14
+ end
15
+
16
+ def registry
17
+ Kiribi::Loader.registry
18
+ end
19
+
20
+ def register(klass, opt = {})
21
+ order = opt[:order] || 0
22
+ path = opt[:path] || klass.name.split("::")
23
+
24
+ registry.reject! { it[:klass] == klass }
25
+ registry << { klass: klass, order: order, path: path }
26
+ end
27
+
28
+ def find_model
29
+ candidates = registry.filter do |entry|
30
+ entry[:path][0...current_path.size] == current_path
31
+ end
32
+
33
+ candidates.min_by { it[:order] }&.[](:klass)
34
+ end
35
+
36
+ def load
37
+ find_model.instantiate
38
+ end
39
+
40
+ def load_onnx
41
+ load.onnx_model
42
+ end
43
+
44
+ def instantiate(...)
45
+ new(...)
46
+ end
47
+ end
48
+
49
+ extend Kiribi::Loader
50
+ end
metadata ADDED
@@ -0,0 +1,41 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: kiribi
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - matsudai
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
12
+ executables: []
13
+ extensions: []
14
+ extra_rdoc_files: []
15
+ files:
16
+ - LICENSE.txt
17
+ - Rakefile
18
+ - lib/kiribi.rb
19
+ - lib/kiribi/version.rb
20
+ homepage: https://github.com/matsudai/kiribi
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 3.4.0
32
+ required_rubygems_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ requirements: []
38
+ rubygems_version: 3.6.9
39
+ specification_version: 4
40
+ summary: Easy to use some onnx models. Use kiribi-multilingual_e5-small instead.
41
+ test_files: []