what_you_say 0.1.0-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +50 -0
- data/lib/what_you_say/3.1/what_you_say.bundle +0 -0
- data/lib/what_you_say/3.2/what_you_say.bundle +0 -0
- data/lib/what_you_say/extension.rb +14 -0
- data/lib/what_you_say/info.rb +6 -0
- data/lib/what_you_say/lang.rb +6 -0
- data/lib/what_you_say/version.rb +5 -0
- data/lib/what_you_say.rb +23 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b12c5ce67b1364775574e25401c1e926c06009bc5f3962b7d92c73f45b5861a5
|
4
|
+
data.tar.gz: aa9ec482beaa57ea43f4c9676c6fee89583987caa69d661353aaaf022a145523
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8220d9fea037a16cae853b6462387ea327195ce61e4af0f72fd2250cd051bf7e3bbcf4d946e9460adfa30f3df8cbac1ce49ff5d4bf10646f1caba893d2814b14
|
7
|
+
data.tar.gz: f7714b85f3cd2c31b74168910f1e0f7b71cb058b33abd9097cfe38f7c55906181e76725f62488ec777d9563e1a298b17c3cca27fff733dabd2931287e68badf4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 Garen J. Torikian
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# WhatYouSay
|
2
|
+
|
3
|
+
![What you say!!](https://user-images.githubusercontent.com/64050/224237944-ceb2570c-d544-474a-8c91-41433efdee43.png)
|
4
|
+
|
5
|
+
- Supports [69 languages](https://github.com/greyblake/whatlang-rs/blob/master/SUPPORTED_LANGUAGES.md) (nice!)
|
6
|
+
- Core library is written in Rust; this is a Ruby wrapper to it
|
7
|
+
- Lightweight, fast, and simple
|
8
|
+
- Recognizes not only a language, but also a script (Latin, Cyrillic, etc)
|
9
|
+
- Provides reliability information
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Install the gem and add to the application's Gemfile by executing:
|
14
|
+
|
15
|
+
$ bundle add what_you_say
|
16
|
+
|
17
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
18
|
+
|
19
|
+
$ gem install what_you_say
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
The method to call is `_?`. Why? Because. Pass in the text whose language you want to detect:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
text = "Ĉu vi ne volas eklerni Esperanton? Bonvolu! Estas unu de la plej bonaj aferoj!"
|
27
|
+
|
28
|
+
result = WhatYouSay._?(text)
|
29
|
+
|
30
|
+
assert_equal("epo", result.lang.code)
|
31
|
+
assert_equal("Esperanto", result.lang.name)
|
32
|
+
assert_equal("Esperanto", result.lang.eng_name)
|
33
|
+
assert_equal("Latin", result.script)
|
34
|
+
assert_predicate(result, :reliable?)
|
35
|
+
assert_equal(1, result.confidence)
|
36
|
+
```
|
37
|
+
|
38
|
+
## Development
|
39
|
+
|
40
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake compile test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
41
|
+
|
42
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and merge that change into `main`.
|
43
|
+
|
44
|
+
## Contributing
|
45
|
+
|
46
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/gjtorikian/what_you_say.
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
Binary file
|
Binary file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
begin
|
4
|
+
# native precompiled gems package shared libraries in <gem_dir>/lib/what_you_say/<ruby_version>
|
5
|
+
# load the precompiled extension file
|
6
|
+
ruby_version = /\d+\.\d+/.match(RUBY_VERSION)
|
7
|
+
require_relative "#{ruby_version}/what_you_say"
|
8
|
+
rescue LoadError
|
9
|
+
# fall back to the extension compiled upon installation.
|
10
|
+
# use "require" instead of "require_relative" because non-native gems will place C extension files
|
11
|
+
# in Gem::BasicSpecification#extension_dir after compilation (during normal installation), which
|
12
|
+
# is in $LOAD_PATH but not necessarily relative to this file (see nokogiri#2300)
|
13
|
+
require "what_you_say/what_you_say"
|
14
|
+
end
|
data/lib/what_you_say.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "what_you_say/extension"
|
4
|
+
|
5
|
+
require "what_you_say/info"
|
6
|
+
require "what_you_say/lang"
|
7
|
+
require "what_you_say/version"
|
8
|
+
|
9
|
+
if ENV.fetch("DEBUG", false)
|
10
|
+
require "awesome_print"
|
11
|
+
require "debug"
|
12
|
+
end
|
13
|
+
|
14
|
+
module WhatYouSay
|
15
|
+
class << self
|
16
|
+
def _?(text)
|
17
|
+
raise TypeError, "text must be a String; got a #{text.class}!" unless text.is_a?(String)
|
18
|
+
raise TypeError, "text must be UTF-8 encoded; got #{text.encoding}!" unless text.encoding.name == "UTF-8"
|
19
|
+
|
20
|
+
detect(text, options: {})
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: what_you_say
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: x86_64-darwin
|
6
|
+
authors:
|
7
|
+
- Garen J. Torikian
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-03-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '13.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '13.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake-compiler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.2'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.2'
|
41
|
+
description: Natural language detectio with a focus on simplicity and performance.
|
42
|
+
Currently wraps the whatlang Rust crate.
|
43
|
+
email:
|
44
|
+
- gjtorikian@users.noreply.github.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- LICENSE.txt
|
50
|
+
- README.md
|
51
|
+
- lib/what_you_say.rb
|
52
|
+
- lib/what_you_say/3.1/what_you_say.bundle
|
53
|
+
- lib/what_you_say/3.2/what_you_say.bundle
|
54
|
+
- lib/what_you_say/extension.rb
|
55
|
+
- lib/what_you_say/info.rb
|
56
|
+
- lib/what_you_say/lang.rb
|
57
|
+
- lib/what_you_say/version.rb
|
58
|
+
homepage: https://github.com/gjtorikian/what_you_say
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata:
|
62
|
+
allowed_push_host: https://rubygems.org
|
63
|
+
funding_uri: https://github.com/sponsors/gjtorikian/
|
64
|
+
source_code_uri: https://github.com/gjtorikian/what_you_say
|
65
|
+
rubygems_mfa_required: 'true'
|
66
|
+
post_install_message:
|
67
|
+
rdoc_options: []
|
68
|
+
require_paths:
|
69
|
+
- lib
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.1'
|
75
|
+
- - "<"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 3.3.dev
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.3.22
|
83
|
+
requirements: []
|
84
|
+
rubygems_version: 3.4.4
|
85
|
+
signing_key:
|
86
|
+
specification_version: 4
|
87
|
+
summary: Fast and lightweight language identification library. Written in Rust, wrapped
|
88
|
+
in Ruby.
|
89
|
+
test_files: []
|