inci_score 4.5.0 → 4.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/config/catalog.yml +2 -0
- data/lib/inci_score/ingredient.rb +1 -1
- data/lib/inci_score/recognizer_rules.rb +6 -2
- data/lib/inci_score/response.rb +1 -1
- data/lib/inci_score/scorer.rb +5 -1
- data/lib/inci_score/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: 9b62e565ea7191b030ebcdf3b278130065ecb325743bf4ca618e0c8e7d7559a8
|
4
|
+
data.tar.gz: 0fcbf56e6edb8a314c202200e89d8f53428b009472440d7a1e92815be90b9df9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f4040838f05e804090a2482d3b6ea03c1c4575e5133a0989af9f733c373f6c1c507426196fca5eba539c4fbe5c3322a62e623a1630c8ade6dfe2f056a616938
|
7
|
+
data.tar.gz: c14b303bae2a60c0f16b1df28e95e77cf2b32caaa33086d8852edf8486dfccbaf29bb361a7d8c2150eb32a569890c84a812369f13bdd38f61df979a76f18abd2
|
data/README.md
CHANGED
@@ -57,7 +57,7 @@ You can include this gem into your own library and start computing the INCI scor
|
|
57
57
|
require "inci_score"
|
58
58
|
|
59
59
|
inci = InciScore::Computer.new(src: 'aqua, dimethicone').call
|
60
|
-
inci.score #
|
60
|
+
inci.score # 56.25
|
61
61
|
```
|
62
62
|
|
63
63
|
As you see the results are wrapped by an *InciScore::Response* object, this is useful when dealing with the CLI and HTTP interfaces (read below).
|
@@ -80,7 +80,7 @@ You can collect INCI data by using the available CLI interface:
|
|
80
80
|
inci_score --src="ingredients: aqua, dimethicone, pej-10, noent"
|
81
81
|
|
82
82
|
TOTAL SCORE:
|
83
|
-
|
83
|
+
53.22
|
84
84
|
PRECISION:
|
85
85
|
75.0
|
86
86
|
COMPONENTS:
|
data/config/catalog.yml
CHANGED
@@ -4019,6 +4019,7 @@ prunus avium: 0
|
|
4019
4019
|
prunus cerasus: 0
|
4020
4020
|
prunus domestica: 0
|
4021
4021
|
prunus dulcis: 0
|
4022
|
+
prunus amygdalus dulcis (sweet almond) oil: 0
|
4022
4023
|
prunus persica: 0
|
4023
4024
|
prunus serotina: 0
|
4024
4025
|
prunus spinosa: 0
|
@@ -4908,6 +4909,7 @@ tripeptide-29: 1
|
|
4908
4909
|
triphenyl trimethicone: 4
|
4909
4910
|
tripotassium edta: 4
|
4910
4911
|
trisodium edta: 4
|
4912
|
+
trisodium ethylenediamine disuccinate: 2
|
4911
4913
|
trisodium hedta: 4
|
4912
4914
|
trisodium lauroampho pg-acetate phosphate chloride: 3
|
4913
4915
|
trisodium methylglycinediacetate: 1
|
@@ -25,7 +25,7 @@ module InciScore
|
|
25
25
|
if parenthesis?
|
26
26
|
parenthesis = PARENTHESIS.join
|
27
27
|
parenthesis_values = raw.match(PARENTHESIS_RULE).captures.map { |c| c.delete(parenthesis) }
|
28
|
-
deparenthesized = raw.sub(PARENTHESIS_RULE, '').sub(/\s
|
28
|
+
deparenthesized = raw.sub(PARENTHESIS_RULE, '').sub(/\s{2,}/, ' ').strip
|
29
29
|
[deparenthesized].concat(parenthesis_values)
|
30
30
|
else
|
31
31
|
raw.split(SLASH_RULE).map(&:strip)
|
@@ -7,7 +7,11 @@ module InciScore
|
|
7
7
|
module Rules
|
8
8
|
TOLERANCE = 3
|
9
9
|
|
10
|
-
Component = Struct.new(:name, :hazard)
|
10
|
+
Component = Struct.new(:name, :hazard) do
|
11
|
+
def to_s
|
12
|
+
"#{name} (#{hazard})"
|
13
|
+
end
|
14
|
+
end
|
11
15
|
|
12
16
|
Key = ->(src) do
|
13
17
|
score = Config::CATALOG[src]
|
@@ -53,7 +57,7 @@ module InciScore
|
|
53
57
|
def call(src)
|
54
58
|
return if src.size < TOLERANCE
|
55
59
|
digits = src[0, MIN_MEANINGFUL]
|
56
|
-
pairs = Config::CATALOG.detect { |name, _| name.start_with?(digits) }
|
60
|
+
pairs = Config::CATALOG.detect { |name, _| name.start_with?(digits) }
|
57
61
|
Component.new(*pairs) if pairs
|
58
62
|
end
|
59
63
|
end
|
data/lib/inci_score/response.rb
CHANGED
data/lib/inci_score/scorer.rb
CHANGED
data/lib/inci_score/version.rb
CHANGED