lingua_rs 0.4.2 → 0.4.4
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/README.md +28 -8
- data/ext/lingua/extconf.rb +4 -1
- data/lib/lingua/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 151633d9585ecca170847b63a380b257178573a6f8fcb395d8ff731acfc0df4d
|
|
4
|
+
data.tar.gz: 97ddfa0dcf4cf4943afcf65cb4240dd3f7e7d0b39936d36f38deb1a5224d3994
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 634d5762de12f35056462e61160e7b2dc730f9970ba9a4248c13daf8c93ab5d6c35d010576a2b1cf5255756e0319ec0409b3cd21fedf36aff970c7ac22e2efeb
|
|
7
|
+
data.tar.gz: f27c9d123beee999fc57d13ab41f2b3029855bb957e363621092dafb9e6ccad8246a37a097b0b5ee4a5025762df04048e70d8a292984f856558fd67b8ece8855
|
data/README.md
CHANGED
|
@@ -213,21 +213,41 @@ end
|
|
|
213
213
|
|
|
214
214
|
## Optimization: selecting languages
|
|
215
215
|
|
|
216
|
-
By default, all 75 languages are compiled into the native extension (~278 MB). If you only need a subset,
|
|
216
|
+
By default, all 75 languages are compiled into the native extension (~278 MB). If you only need a subset, select languages at build time to reduce binary size and improve detection speed.
|
|
217
|
+
|
|
218
|
+
### Build option
|
|
219
|
+
|
|
220
|
+
Use `--with-lingua-languages` to select languages. With Bundler you can persist the setting so it applies to every future `bundle install`:
|
|
217
221
|
|
|
218
222
|
```bash
|
|
219
|
-
|
|
223
|
+
bundle config set build.lingua_rs --with-lingua-languages=core
|
|
224
|
+
bundle install
|
|
220
225
|
```
|
|
221
226
|
|
|
222
227
|
This compiles only the selected language models (~29 MB for the `core` bundle). You can use individual language names or predefined bundles, and you can mix both in the same build.
|
|
223
228
|
|
|
224
|
-
|
|
229
|
+
The setting is saved in your local Bundler config (`~/.bundle/config` or `.bundle/config`) and is reused automatically on subsequent installs. To change it later:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
bundle config set build.lingua_rs --with-lingua-languages=europe_common,japanese
|
|
233
|
+
bundle install
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
To remove it and go back to all languages:
|
|
225
237
|
|
|
226
238
|
```bash
|
|
227
|
-
|
|
239
|
+
bundle config unset build.lingua_rs
|
|
240
|
+
bundle install
|
|
228
241
|
```
|
|
229
242
|
|
|
230
|
-
|
|
243
|
+
This also works with `gem install`:
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
gem install lingua_rs -- --with-lingua-languages=french,english,german
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
### Available languages and bundles
|
|
231
251
|
|
|
232
252
|
| Bundle | Languages |
|
|
233
253
|
| --- | --- |
|
|
@@ -242,9 +262,9 @@ Available bundles:
|
|
|
242
262
|
Examples:
|
|
243
263
|
|
|
244
264
|
```bash
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
265
|
+
bundle config set build.lingua_rs --with-lingua-languages=core
|
|
266
|
+
bundle config set build.lingua_rs --with-lingua-languages=europe_common,polish
|
|
267
|
+
bundle config set build.lingua_rs --with-lingua-languages=east_asia,english
|
|
248
268
|
```
|
|
249
269
|
|
|
250
270
|
Language and bundle names must match the Cargo features defined by this gem (lowercase, e.g. `french`, `english`, `german`, `core`, `europe_common`).
|
data/ext/lingua/extconf.rb
CHANGED
|
@@ -4,8 +4,11 @@ require 'mkmf'
|
|
|
4
4
|
require 'rb_sys/mkmf'
|
|
5
5
|
|
|
6
6
|
# Allow users to select specific languages to reduce binary size.
|
|
7
|
+
# Supports both --with-lingua-languages build option and LINGUA_LANGUAGES env var.
|
|
8
|
+
# Example: bundle config set build.lingua_rs --with-lingua-languages=core
|
|
7
9
|
# Example: LINGUA_LANGUAGES=french,english,german bundle install
|
|
8
|
-
|
|
10
|
+
selection = with_config('lingua-languages', nil) || ENV.fetch('LINGUA_LANGUAGES', '')
|
|
11
|
+
languages = selection.to_s.split(',').map { |lang| lang.strip.downcase }.reject(&:empty?)
|
|
9
12
|
|
|
10
13
|
create_rust_makefile('lingua/lingua') do |r|
|
|
11
14
|
unless languages.empty?
|
data/lib/lingua/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lingua_rs
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sébastien Vrillaud
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-04-06 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rb_sys
|
|
@@ -85,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
85
85
|
- !ruby/object:Gem::Version
|
|
86
86
|
version: '0'
|
|
87
87
|
requirements: []
|
|
88
|
-
rubygems_version:
|
|
88
|
+
rubygems_version: 4.0.9
|
|
89
89
|
specification_version: 4
|
|
90
|
-
summary: High-accuracy language detection
|
|
90
|
+
summary: High-accuracy language detection powered by Lingua (Rust).
|
|
91
91
|
test_files: []
|