blingfire 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/LICENSE.txt +1 -1
- data/README.md +9 -9
- data/lib/blingfire/model.rb +1 -6
- data/lib/blingfire/version.rb +1 -1
- data/lib/blingfire.rb +4 -4
- metadata +7 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1d50b260b52505d373156fad02a822da03c95be9c4934f1c3beb5f7c38e650a
|
4
|
+
data.tar.gz: '067318eeb1f9901d36dbd33131823f70247d38ca49b755b8da407f45c14ee2e6'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d5bd5569ed024dd9ebfe841cb6f136e15625cf00194463f5208e81d3d27630426ae944af43be8628aa28e076c40eeb541f336fa33b81f9da505c3a9109ee8cf
|
7
|
+
data.tar.gz: 8c93fb8cda66ef23d61cd427a5e94d9fccdd89205680ed9d221da91b34941486a02b12b4e83b5e1e1a55bc7080d54d4040d8b61e8e0ecbddc852f8003f99fe7c
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
3
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
4
|
-
Copyright (c) 2020 Andrew Kane
|
4
|
+
Copyright (c) 2020-2023 Andrew Kane
|
5
5
|
|
6
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
# Bling Fire
|
1
|
+
# Bling Fire Ruby
|
2
2
|
|
3
3
|
[Bling Fire](https://github.com/microsoft/BlingFire) - high speed text tokenization - for Ruby
|
4
4
|
|
5
|
-
[![Build Status](https://github.com/ankane/blingfire/workflows/build/badge.svg?branch=master)](https://github.com/ankane/blingfire/actions)
|
5
|
+
[![Build Status](https://github.com/ankane/blingfire-ruby/workflows/build/badge.svg?branch=master)](https://github.com/ankane/blingfire-ruby/actions)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
9
|
Add this line to your application’s Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem
|
12
|
+
gem "blingfire"
|
13
13
|
```
|
14
14
|
|
15
15
|
## Getting Started
|
@@ -82,7 +82,7 @@ Disable prefix space
|
|
82
82
|
model = BlingFire.load_model("roberta.bin", prefix: false)
|
83
83
|
```
|
84
84
|
|
85
|
-
## Ids to Text
|
85
|
+
## Ids to Text
|
86
86
|
|
87
87
|
Load a model
|
88
88
|
|
@@ -98,22 +98,22 @@ model.ids_to_text(ids)
|
|
98
98
|
|
99
99
|
## History
|
100
100
|
|
101
|
-
View the [changelog](https://github.com/ankane/blingfire/blob/master/CHANGELOG.md)
|
101
|
+
View the [changelog](https://github.com/ankane/blingfire-ruby/blob/master/CHANGELOG.md)
|
102
102
|
|
103
103
|
## Contributing
|
104
104
|
|
105
105
|
Everyone is encouraged to help improve this project. Here are a few ways you can help:
|
106
106
|
|
107
|
-
- [Report bugs](https://github.com/ankane/blingfire/issues)
|
108
|
-
- Fix bugs and [submit pull requests](https://github.com/ankane/blingfire/pulls)
|
107
|
+
- [Report bugs](https://github.com/ankane/blingfire-ruby/issues)
|
108
|
+
- Fix bugs and [submit pull requests](https://github.com/ankane/blingfire-ruby/pulls)
|
109
109
|
- Write, clarify, or fix documentation
|
110
110
|
- Suggest or add new features
|
111
111
|
|
112
112
|
To get started with development:
|
113
113
|
|
114
114
|
```sh
|
115
|
-
git clone https://github.com/ankane/blingfire.git
|
116
|
-
cd blingfire
|
115
|
+
git clone https://github.com/ankane/blingfire-ruby.git
|
116
|
+
cd blingfire-ruby
|
117
117
|
bundle install
|
118
118
|
bundle exec rake vendor:all download:models
|
119
119
|
bundle exec rake test
|
data/lib/blingfire/model.rb
CHANGED
@@ -5,7 +5,7 @@ module BlingFire
|
|
5
5
|
if path
|
6
6
|
raise Error, "Model not found" unless File.exist?(path)
|
7
7
|
@handle = FFI.LoadModel(path)
|
8
|
-
|
8
|
+
@handle.free = FFI["FreeModel"]
|
9
9
|
|
10
10
|
BlingFire.change_settings_dummy_prefix(@handle, prefix) unless prefix.nil?
|
11
11
|
else
|
@@ -72,10 +72,5 @@ module BlingFire
|
|
72
72
|
def to_ptr
|
73
73
|
@handle
|
74
74
|
end
|
75
|
-
|
76
|
-
def self.finalize(pointer)
|
77
|
-
# must use proc instead of stabby lambda
|
78
|
-
proc { FFI.FreeModel(pointer) }
|
79
|
-
end
|
80
75
|
end
|
81
76
|
end
|
data/lib/blingfire/version.rb
CHANGED
data/lib/blingfire.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
require "fiddle/import"
|
3
3
|
|
4
4
|
# modules
|
5
|
-
|
6
|
-
|
5
|
+
require_relative "blingfire/model"
|
6
|
+
require_relative "blingfire/version"
|
7
7
|
|
8
8
|
module BlingFire
|
9
9
|
class Error < StandardError; end
|
@@ -15,13 +15,13 @@ module BlingFire
|
|
15
15
|
if Gem.win_platform?
|
16
16
|
"blingfiretokdll.dll"
|
17
17
|
elsif RbConfig::CONFIG["host_os"] =~ /darwin/i
|
18
|
-
if RbConfig::CONFIG["host_cpu"] =~ /arm/i
|
18
|
+
if RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i
|
19
19
|
"libblingfiretokdll.arm64.dylib"
|
20
20
|
else
|
21
21
|
"libblingfiretokdll.dylib"
|
22
22
|
end
|
23
23
|
else
|
24
|
-
if RbConfig::CONFIG["host_cpu"] =~ /aarch64/i
|
24
|
+
if RbConfig::CONFIG["host_cpu"] =~ /arm|aarch64/i
|
25
25
|
"libblingfiretokdll.arm64.so"
|
26
26
|
else
|
27
27
|
"libblingfiretokdll.so"
|
metadata
CHANGED
@@ -1,59 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blingfire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: minitest
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '5'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '5'
|
11
|
+
date: 2023-09-21 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
55
13
|
description:
|
56
|
-
email: andrew@
|
14
|
+
email: andrew@ankane.org
|
57
15
|
executables: []
|
58
16
|
extensions: []
|
59
17
|
extra_rdoc_files: []
|
@@ -71,7 +29,7 @@ files:
|
|
71
29
|
- vendor/libblingfiretokdll.arm64.so
|
72
30
|
- vendor/libblingfiretokdll.dylib
|
73
31
|
- vendor/libblingfiretokdll.so
|
74
|
-
homepage: https://github.com/ankane/blingfire
|
32
|
+
homepage: https://github.com/ankane/blingfire-ruby
|
75
33
|
licenses:
|
76
34
|
- MIT
|
77
35
|
metadata: {}
|
@@ -83,14 +41,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
41
|
requirements:
|
84
42
|
- - ">="
|
85
43
|
- !ruby/object:Gem::Version
|
86
|
-
version: '
|
44
|
+
version: '3'
|
87
45
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
46
|
requirements:
|
89
47
|
- - ">="
|
90
48
|
- !ruby/object:Gem::Version
|
91
49
|
version: '0'
|
92
50
|
requirements: []
|
93
|
-
rubygems_version: 3.
|
51
|
+
rubygems_version: 3.4.10
|
94
52
|
signing_key:
|
95
53
|
specification_version: 4
|
96
54
|
summary: High speed text tokenization for Ruby
|