litsea 0.13.0 → 0.14.3
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 +4 -4
- data/Cargo.toml +49 -16
- data/LICENSE +52 -0
- data/README.md +13 -3
- data/README_ja.md +13 -3
- data/lib/litsea/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 849682ce4467eef85788f31a19183ae366bd3c5dd642d3aaa47998f6b1988e1c
|
|
4
|
+
data.tar.gz: 2458ce9b638527048aa071f83b0743ae6ede8ae45d64c04b67d2fe8fbf33d7c9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 983194c5e2cc5a25b02827085ae9f532ae4d0a238fc32e10107857a3ec20a25ef417019d33e7ce27151d09b050d626280edc5cf037c6769e53a7e37ef0340cc5
|
|
7
|
+
data.tar.gz: 07e311b43e127e758fbf021d54102114e684e287a56858310473a23f12eb3b0de8aa33117fea49b94897bae809c28682aac707d81567b71038a61b37d2e7a8fe
|
data/Cargo.toml
CHANGED
|
@@ -1,25 +1,58 @@
|
|
|
1
|
+
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
|
2
|
+
#
|
|
3
|
+
# When uploading crates to the registry Cargo will automatically
|
|
4
|
+
# "normalize" Cargo.toml files for maximal compatibility
|
|
5
|
+
# with all versions of Cargo and also rewrite `path` dependencies
|
|
6
|
+
# to registry (e.g., crates.io) dependencies.
|
|
7
|
+
#
|
|
8
|
+
# If you are reading this file be aware that the original Cargo.toml
|
|
9
|
+
# will likely look very different (and much more reasonable).
|
|
10
|
+
# See Cargo.toml.orig for the original contents.
|
|
11
|
+
|
|
1
12
|
[package]
|
|
13
|
+
edition = "2024"
|
|
14
|
+
rust-version = "1.87"
|
|
2
15
|
name = "litsea-ruby"
|
|
3
|
-
version
|
|
4
|
-
|
|
5
|
-
|
|
16
|
+
version = "0.14.3"
|
|
17
|
+
build = false
|
|
18
|
+
autolib = false
|
|
19
|
+
autobins = false
|
|
20
|
+
autoexamples = false
|
|
21
|
+
autotests = false
|
|
22
|
+
autobenches = false
|
|
6
23
|
description = "Ruby binding for Litsea."
|
|
24
|
+
homepage = "https://github.com/mosuka/litsea"
|
|
7
25
|
documentation = "https://docs.rs/litsea-ruby"
|
|
8
|
-
homepage.workspace = true
|
|
9
|
-
repository.workspace = true
|
|
10
26
|
readme = "README.md"
|
|
11
|
-
keywords = [
|
|
12
|
-
|
|
13
|
-
|
|
27
|
+
keywords = [
|
|
28
|
+
"word",
|
|
29
|
+
"segmentation",
|
|
30
|
+
"nlp",
|
|
31
|
+
"ruby",
|
|
32
|
+
"binding",
|
|
33
|
+
]
|
|
34
|
+
categories = ["text-processing"]
|
|
35
|
+
license = "MIT"
|
|
36
|
+
repository = "https://github.com/mosuka/litsea"
|
|
14
37
|
|
|
15
38
|
[lib]
|
|
16
39
|
name = "litsea_ruby"
|
|
17
|
-
crate-type = [
|
|
40
|
+
crate-type = [
|
|
41
|
+
"cdylib",
|
|
42
|
+
"lib",
|
|
43
|
+
]
|
|
44
|
+
path = "src/lib.rs"
|
|
45
|
+
|
|
46
|
+
[dependencies.litsea]
|
|
47
|
+
version = "=0.14.3"
|
|
48
|
+
|
|
49
|
+
[dependencies.litsea-binding-core]
|
|
50
|
+
version = "=0.14.3"
|
|
51
|
+
features = ["remote_model"]
|
|
52
|
+
|
|
53
|
+
[dependencies.magnus]
|
|
54
|
+
version = "0.8.2"
|
|
55
|
+
features = ["rb-sys"]
|
|
18
56
|
|
|
19
|
-
[dependencies]
|
|
20
|
-
|
|
21
|
-
litsea-binding-core = { workspace = true, features = ["remote_model"] }
|
|
22
|
-
magnus = { version = "0.8.2", features = ["rb-sys"] }
|
|
23
|
-
# Used only to link against libruby; the GVL entry point is declared by
|
|
24
|
-
# hand in `gvl.rs` because neither magnus nor rb-sys exposes it.
|
|
25
|
-
rb-sys = "0.9.130"
|
|
57
|
+
[dependencies.rb-sys]
|
|
58
|
+
version = "0.9.130"
|
data/LICENSE
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Minoru OSUKA
|
|
4
|
+
Copyright (c) 2022 ICHINOSE Shogo
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
|
|
24
|
+
--------------------------------------------------------------------
|
|
25
|
+
|
|
26
|
+
Copyright (c) 2008, Taku Kudo
|
|
27
|
+
|
|
28
|
+
All rights reserved.
|
|
29
|
+
|
|
30
|
+
Redistribution and use in source and binary forms, with or without
|
|
31
|
+
modification, are permitted provided that the following conditions are met:
|
|
32
|
+
|
|
33
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
34
|
+
this list of conditions and the following disclaimer.
|
|
35
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
36
|
+
notice, this list of conditions and the following disclaimer in the
|
|
37
|
+
documentation and/or other materials provided with the distribution.
|
|
38
|
+
* Neither the name of the <ORGANIZATION> nor the names of its
|
|
39
|
+
contributors may be used to endorse or promote products derived from this
|
|
40
|
+
software without specific prior written permission.
|
|
41
|
+
|
|
42
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
43
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
44
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
45
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
46
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
47
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
48
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
49
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
50
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
51
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
52
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
|
@@ -10,7 +10,13 @@ Ruby binding for [Litsea](https://github.com/mosuka/litsea), a compact word segm
|
|
|
10
10
|
gem install litsea
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
The gem compiles the native extension on install,
|
|
13
|
+
The gem compiles the native extension on install, which takes a minute or two. It needs:
|
|
14
|
+
|
|
15
|
+
- Ruby 3.1 or later, with a C compiler and `make` for building native gems
|
|
16
|
+
- a Rust toolchain, 1.87 or later
|
|
17
|
+
- libclang (`libclang-dev` on Debian and Ubuntu, the Xcode Command Line Tools on macOS)
|
|
18
|
+
|
|
19
|
+
It compiles against the crates.io releases of `litsea` and `litsea-binding-core` of its own version. The gems released from 0.13.0 until the fix for [#247](https://github.com/mosuka/litsea/issues/247) fail to compile during installation; `gem install litsea` picks the newest release, so this matters only when you pin one of them.
|
|
14
20
|
|
|
15
21
|
## Models are not bundled
|
|
16
22
|
|
|
@@ -126,10 +132,14 @@ Every error derives from `Litsea::Error`, so one `rescue` handles them all.
|
|
|
126
132
|
## Development
|
|
127
133
|
|
|
128
134
|
```sh
|
|
129
|
-
make test-litsea-ruby
|
|
130
|
-
make build-litsea-ruby
|
|
135
|
+
make test-litsea-ruby # cargo test + rake compile + rake test
|
|
136
|
+
make build-litsea-ruby # release build
|
|
137
|
+
make package-litsea-ruby # source gem into pkg/
|
|
138
|
+
make test-litsea-ruby-gem # gem install that gem in a clean container (needs Docker)
|
|
131
139
|
```
|
|
132
140
|
|
|
141
|
+
Build the gem with `make package-litsea-ruby` (`bundle exec rake build`), not `gem build`: this directory's `Cargo.toml` only resolves inside the Cargo workspace, so the task builds the gem from the crate as `cargo package` normalizes it.
|
|
142
|
+
|
|
133
143
|
The parity tests build the `litsea` CLI and compare the binding's output against it. Note that `bundle` must be available for the active Ruby; with rbenv, `rbenv local 3.4.9` (or any installed 3.1+) is enough.
|
|
134
144
|
|
|
135
145
|
## License
|
data/README_ja.md
CHANGED
|
@@ -10,7 +10,13 @@
|
|
|
10
10
|
gem install litsea
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
インストール時にネイティブ拡張をコンパイルします(1〜2 分かかります)。次のものが必要です。
|
|
14
|
+
|
|
15
|
+
- Ruby 3.1 以降と、ネイティブ gem のビルドに使う C コンパイラと `make`
|
|
16
|
+
- Rust ツールチェーン 1.87 以降
|
|
17
|
+
- libclang(Debian / Ubuntu は `libclang-dev`、macOS は Xcode Command Line Tools)
|
|
18
|
+
|
|
19
|
+
gem は crates.io 上の同じバージョンの `litsea` と `litsea-binding-core` に対してコンパイルされます。0.13.0 から [#247](https://github.com/mosuka/litsea/issues/247) の修正までにリリースされた gem は、インストール時のコンパイルに失敗します。`gem install litsea` は最新のリリースを選ぶため、影響があるのはそれらのバージョンを指定した場合だけです。
|
|
14
20
|
|
|
15
21
|
## モデルは同梱されません
|
|
16
22
|
|
|
@@ -126,10 +132,14 @@ metrics = Litsea::Trainer.new(0.01, 100_000, "features.txt").train("japanese.mod
|
|
|
126
132
|
## 開発
|
|
127
133
|
|
|
128
134
|
```sh
|
|
129
|
-
make test-litsea-ruby
|
|
130
|
-
make build-litsea-ruby
|
|
135
|
+
make test-litsea-ruby # cargo test + rake compile + rake test
|
|
136
|
+
make build-litsea-ruby # リリースビルド
|
|
137
|
+
make package-litsea-ruby # ソース gem を pkg/ に出力
|
|
138
|
+
make test-litsea-ruby-gem # その gem をクリーンなコンテナで gem install(Docker が必要)
|
|
131
139
|
```
|
|
132
140
|
|
|
141
|
+
gem は `gem build` ではなく `make package-litsea-ruby`(`bundle exec rake build`)でビルドしてください。このディレクトリの `Cargo.toml` は Cargo ワークスペースの中でしか解決できないため、このタスクは `cargo package` が正規化したクレートから gem をビルドします。
|
|
142
|
+
|
|
133
143
|
パリティテストは `litsea` CLI をビルドし、その出力とバインディングの出力を突き合わせます。なお、有効な Ruby に `bundle` が入っている必要があります(rbenv なら `rbenv local 3.4.9` などで 3.1 以降を選択してください)。
|
|
134
144
|
|
|
135
145
|
## ライセンス
|
data/lib/litsea/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: litsea
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.14.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Minoru Osuka
|
|
@@ -31,6 +31,7 @@ extensions:
|
|
|
31
31
|
extra_rdoc_files: []
|
|
32
32
|
files:
|
|
33
33
|
- Cargo.toml
|
|
34
|
+
- LICENSE
|
|
34
35
|
- README.md
|
|
35
36
|
- README_ja.md
|
|
36
37
|
- extconf.rb
|