what_you_say 0.7.0 → 0.7.1
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 +3 -0
- data/README.md +24 -0
- data/ext/what_you_say/Cargo.toml +1 -0
- data/lib/what_you_say/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 580254e76b6e4e0fd78525f421c5c68f6c35d901a054ada79d4ae167968f407c
|
|
4
|
+
data.tar.gz: 2eae89fbf0f2cac8c71e48ea6c5ac0353e0547c0ee974de074e908b1db346500
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff22afc023054957cc7e32d9b8abcb90e67fb461696c2d63ac435232284fc67ce5fecc84bd9831a3550707b204489d190f45d263af8c0b2f42ce785c0fdb5d74
|
|
7
|
+
data.tar.gz: 667b40cfff18ecb04ef7e6c135c0b005130fe2d3f7925102ff95006a5f311304fa7edba3faaf0288788c31591d36952fd77c5fba5cd7440c5482b1ff4f9737cf
|
data/Cargo.toml
CHANGED
data/README.md
CHANGED
|
@@ -68,6 +68,30 @@ assert_equal("???", result.code)
|
|
|
68
68
|
assert_equal("unknown", result.eng_name)
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
+
### Detection with confidence scores
|
|
72
|
+
|
|
73
|
+
Use `detect_language_with_confidence` to get all candidate languages ranked by their detection confidence:
|
|
74
|
+
|
|
75
|
+
```ruby
|
|
76
|
+
detector = WhatYouSay.new(allowlist: ["English", "French", "German", "Spanish"])
|
|
77
|
+
detector.detect_language_with_confidence("languages are awesome")
|
|
78
|
+
# => [[#<WhatYouSay::Lang code="eng" eng_name="English">, 0.9250120192490813],
|
|
79
|
+
# [#<WhatYouSay::Lang code="fra" eng_name="French">, 0.043595558302827526],
|
|
80
|
+
# [#<WhatYouSay::Lang code="deu" eng_name="German">, 0.020589166619996536],
|
|
81
|
+
# [#<WhatYouSay::Lang code="spa" eng_name="Spanish">, 0.01080325582809466]]
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This is useful when you need to apply confidence thresholds, handle ambiguous text, or consider alternative language candidates.
|
|
85
|
+
|
|
86
|
+
#### Interpreting the result
|
|
87
|
+
|
|
88
|
+
- Results are ordered from most to least likely.
|
|
89
|
+
- In this example:
|
|
90
|
+
- English is the most likely match (~92.5%)
|
|
91
|
+
- French, German, and Spanish are much less likely
|
|
92
|
+
- The scores represent relative confidence across the allowed languages.
|
|
93
|
+
|
|
94
|
+
|
|
71
95
|
## Development
|
|
72
96
|
|
|
73
97
|
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.
|
data/ext/what_you_say/Cargo.toml
CHANGED
data/lib/what_you_say/version.rb
CHANGED