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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10f60785757487a1928e8d35dff0a23a5b10143f69cd4c147fe4da13b7362e31
4
- data.tar.gz: 587f8b61751bee91d89df4fa2c278163cdd48c601536292f56ed35f4807044fd
3
+ metadata.gz: 151633d9585ecca170847b63a380b257178573a6f8fcb395d8ff731acfc0df4d
4
+ data.tar.gz: 97ddfa0dcf4cf4943afcf65cb4240dd3f7e7d0b39936d36f38deb1a5224d3994
5
5
  SHA512:
6
- metadata.gz: '03383e1fa0da8d3131f2e8d724b5818697bcddae9604d33a3cfafe7b73b48d32468f2817eaa5b1606f726b47a326b7f2c48f46ef5b3361a605b4f7a7c3b20cc2'
7
- data.tar.gz: e347f5ef0485bda583d4df5cfa116699b496184554a2d367615ff3e538e8a8a76769aca20c74a2f67f7fe2caf870d6184d28733e1d040f84d2ca5be8c21ecaf6
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, set the `LINGUA_LANGUAGES` environment variable before installing to reduce binary size and improve detection speed:
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
- LINGUA_LANGUAGES=core bundle install
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
- This also works with `gem install`, for example:
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
- LINGUA_LANGUAGES=french,english,german gem install lingua_rs
239
+ bundle config unset build.lingua_rs
240
+ bundle install
228
241
  ```
229
242
 
230
- Available bundles:
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
- LINGUA_LANGUAGES=core bundle install
246
- LINGUA_LANGUAGES=europe_common,polish bundle install
247
- LINGUA_LANGUAGES=east_asia,english bundle install
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`).
@@ -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
- languages = ENV.fetch('LINGUA_LANGUAGES', '').split(',').map { |lang| lang.strip.downcase }
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?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lingua
4
- VERSION = '0.4.2'
4
+ VERSION = '0.4.4'
5
5
  end
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.2
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: 1980-01-02 00:00:00.000000000 Z
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: 3.6.9
88
+ rubygems_version: 4.0.9
89
89
  specification_version: 4
90
- summary: High-accuracy language detection for Ruby, powered by Lingua (Rust).
90
+ summary: High-accuracy language detection powered by Lingua (Rust).
91
91
  test_files: []