
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Ruby bindings for Whatlang, a natural language detection for Rust.
Features are derived from original Whatlang library, which includes:
You need Rust's build environment to install this gem.
For Unix like system, run
% curl https://sh.rustup.rs -sSf | sh
For Windows, download and run installer.
See Rust official installation page for details.
Add this line to your application's Gemfile:
gem 'whatlang'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install whatlang
require "whatlang"
text = "Благодаря Эсперанто вы обрётете друзей по всему миру!"
info = Whatlang.detect(text)
info.lang.code # => "bul"
info.lang.name # => "Български"
info.lang.eng_name # => "Bulgarian"
info.script # => "Cyrillic"
info.confidence # => 0.2568924409819 (0 to 1 value)
info.reliable? # => false
text = "Jen la trinkejo fermitis, ni iras tra mallumo kaj pluvo."
list = ["eng", "ita"]
Whatlang.detect(text, allowlist: list).lang.code # => "ita"
Whatlang.detect(text, denylist: list).lang.code # => "epo"
If you're interested in only language information, use detect_lang
function:
lang = Whatlang.detect_lang(text)
lang.code # => "bul"
lang.name # => "Български"
lang.eng_name # => "Bulgarian"
Also, Whatlang can detect only scripts:
Whatlang.detect_script(text) # => "Cyrillic"
After checking out the repo, run bundle config set --local vendor/bundle && bundle install
to install dependencies. Then, run bundle exec rake test
to run the tests. You can also run bundle exec rake console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in Cargo.toml
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://gitlab.com/KitaitiMakoto/whatlang-rb.
This RubyGem distributed under the Ruby's license. See {file:COPYING} file.
FAQs
Unknown package
We found that whatlang demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.