inci_score 4.2.1 → 4.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07a79ba247cd43e62ef0988548df410598bf87cb653fd1540f8c6e419a31d03a
4
- data.tar.gz: d0ea4f382824592d33d5bc6ec8bc5d3f88c6a704d24f093259a90da77bf3c6c9
3
+ metadata.gz: 462ec33d1c493272235feaef061ac62822c4dfd6ad6c339e858da8fdfa491894
4
+ data.tar.gz: 42f1e47b971185e92d4af19f2fbdee0f363dc9f241041b8ed800230ae9bd0e22
5
5
  SHA512:
6
- metadata.gz: 5b92528b5d0ef275afce0db6c5d8039eb48daa2e08c098cd5d768dc61be10c2bfa72c24795dea1f28ebc54ef3287beb60449a4a41930e19283072a7c3948cc6f
7
- data.tar.gz: e414756b761775502d54ab4e62e20385148a1a706fed3057ad5a74b47be7ee8274cddcde235d357851158e3e5b28f9961e7873dd675125291b1c226b6f2dc71f
6
+ metadata.gz: cc4f049d56ea9fc60ce92943d7da50c15b697f8712733b409e3327ab73b3c4c0e60d0687f55fcbbefb9f4fd2fdc4c05fe5aa86435f5b75fb558bf456744c9cc4
7
+ data.tar.gz: a706360921a1cc36b1b5f1fef53932b859de69a27b02fd8b662b76dc8fe9808e1409779297bfa159c0d57bc6bb1dfb6e5287d4455def84500ce194fa0102706a
data/README.md CHANGED
@@ -9,8 +9,9 @@
9
9
  * [Usage](#usage)
10
10
  * [Library](#library)
11
11
  * [CLI](#cli)
12
- * [Benchmark](#benchmark)
12
+ * [Benchmarks](#benchmark)
13
13
  * [Levenshtein in C](#levenshtein-in-c)
14
+ * [Run benchmarks](#run-benchmarks)
14
15
 
15
16
  ## Scope
16
17
  This gem computes the score of cosmetic components basing on the information provided by the [Biodizionario site](http://www.biodizionario.it/) by Fabrizio Zago.
@@ -56,7 +57,7 @@ You can include this gem into your own library and start computing the INCI scor
56
57
  require "inci_score"
57
58
 
58
59
  inci = InciScore::Computer.new(src: 'aqua, dimethicone').call
59
- inci.score # 53.7629
60
+ inci.score # 53.76
60
61
  ```
61
62
 
62
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,12 +81,10 @@ inci_score --src="ingredients: aqua, dimethicone, pej-10, noent"
80
81
 
81
82
  TOTAL SCORE:
82
83
  47.18
83
- VALID STATE:
84
- true
85
84
  PRECISION:
86
85
  75.0
87
86
  COMPONENTS:
88
- aqua\n dimethicone\n peg-10
87
+ aqua (0), dimethicone (4), peg-10 (3)
89
88
  UNRECOGNIZED:
90
89
  noent
91
90
  ```
@@ -98,15 +97,17 @@ Usage: inci_score --src="aqua, parfum, etc"
98
97
  -h, --help Prints this help
99
98
  ```
100
99
 
101
- ## Benchmark
100
+ ## Benchmarks
102
101
 
103
102
  ### Levenshtein in C
104
103
  I noticed the APIs slows down dramatically when dealing with unrecognized components to fuzzy match on.
105
104
  I profiled the code by using the [benchmark-ips](https://github.com/evanphx/benchmark-ips) gem, finding the bottleneck was the pure Ruby implementation of the Levenshtein distance algorithm.
106
- After some pointless optimization, i replaced this routine with a C implementation: i opted for the straightforward [Ruby Inline](https://github.com/seattlerb/rubyinline) library to call the C code straight from Ruby.
107
105
 
108
- Once downloaded source code, run the bench specs by:
106
+ After some pointless optimization, i replaced this routine with a C implementation: i opted for the straightforward [Ruby Inline](https://github.com/seattlerb/rubyinline) library to call the C code straight from Ruby, gaining an order of magnitude in speed (x30).
107
+
108
+ ### Run benchmarks
109
+ Once downloaded source code, run the benchmarks by:
109
110
 
110
111
  ```shell
111
- bundle exec rake spec:bench
112
+ bundle exec rake bench
112
113
  ```
data/config/catalog.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  ---
2
- generic-hazard: 3
3
2
  aqua: 0
4
3
  water: 0
5
4
  parfum: 3
@@ -72,6 +71,7 @@ acetanilid: 3
72
71
  acetic acid: 0
73
72
  acetone: 3
74
73
  acetum: 0
74
+ acetyl tyrosine: 3
75
75
  acetylated castor oil: 0
76
76
  acetylated lanolin: 2
77
77
  acetylated lanolin alcohol: 1
@@ -155,6 +155,7 @@ algin: 0
155
155
  alginic acid: 0
156
156
  alkanna tinctoria: 0
157
157
  alkyl benzenesulfonic acid sodium salt: 3
158
+ alkyldimethylsilyl polypropylsesquioxane: 3
158
159
  allantoin: 0
159
160
  allantoin acetyl methionine: 0
160
161
  allantoin ascorbate: 0
@@ -323,6 +324,7 @@ arnica montana: 0
323
324
  artemisia abrotanum: 0
324
325
  artemisia absinthium: 4
325
326
  artemisia vulgaris: 0
327
+ ascophyllum nodosum extract: 0
326
328
  ascorbic acid: 0
327
329
  ascorbic acid polypeptide: 1
328
330
  ascorbyl dipalmitate: 1
@@ -661,6 +663,7 @@ capryl hydroxyethyl imidazoline: 2
661
663
  capryleth-4 carboxylic acid: 3
662
664
  capryleth-6 carboxylic acid: 3
663
665
  capryleth-9 carboxylic acid: 3
666
+ caprylhydroxamic acid: 3
664
667
  caprylic acid: 1
665
668
  caprylic alcohol: 1
666
669
  caprylic/capric glycerides: 0
@@ -1349,6 +1352,7 @@ dioscorea villosa: 0
1349
1352
  diospyros kaki: 0
1350
1353
  dipalmitoylethyl hydroxyethylmonium methosulfate: 1
1351
1354
  dipalmoylethyl hydroxyethylmonium methosulfate: 1
1355
+ dipentaerythrityl tetrabehenate/polyhydroxystearate: 1
1352
1356
  diphenyl dimethicone: 4
1353
1357
  dipotassium aspartate: 1
1354
1358
  dipotassium azelate: 1
@@ -1566,6 +1570,8 @@ euglena gracilis: 0
1566
1570
  eupatorium purpureum: 0
1567
1571
  euphorbia hirta: 0
1568
1572
  euphrasia officinalis: 0
1573
+ euterpe edulis: 0
1574
+ euterpe oleracea: 0
1569
1575
  evernia furfuracea: 3
1570
1576
  evernia prunastri: 3
1571
1577
  fabiana imbricata: 0
@@ -1612,6 +1618,7 @@ ginkgo biloba: 0
1612
1618
  ginseng hydroxypropyltrimonium chloride: 3
1613
1619
  glechoma hederacea: 0
1614
1620
  glucamine: 0
1621
+ glucomannan/konjac: 1
1615
1622
  gluconic acid: 0
1616
1623
  gluconolactone: 0
1617
1624
  glucosamine: 0
@@ -1796,6 +1803,7 @@ hexamidine: 3
1796
1803
  hexamidine diisethionate: 3
1797
1804
  hexamidine paraben: 3
1798
1805
  hexane: 3
1806
+ hexanediol: 3
1799
1807
  hexyl cinnamal: 2
1800
1808
  hexyl laurate: 0
1801
1809
  hexyldecyl laurate: 2
@@ -1996,10 +2004,12 @@ indigofera tinctoria: 0
1996
2004
  inositol: 0
1997
2005
  inositol hexanicotinate: 2
1998
2006
  inula helenium: 4
2007
+ inulin: 1
1999
2008
  iodized corn protein: 0
2000
2009
  iodized garlic: 0
2001
2010
  iodized garlic extract: 0
2002
2011
  iodized hydrolyzed zein: 1
2012
+ iodopropynyl butylcarbamate: 3
2003
2013
  ipomoea purga: 0
2004
2014
  iris florentina: 0
2005
2015
  iris pallida: 0
@@ -2059,6 +2069,7 @@ isolaureth-10: 3
2059
2069
  isolaureth-3: 3
2060
2070
  isolaureth-6: 3
2061
2071
  isolauryl behenate: 1
2072
+ isomalt: 2
2062
2073
  isooctyl thioglycolate: 3
2063
2074
  isopropanolamine nitrite: 4
2064
2075
  isopropyl acetate: 3
@@ -2792,6 +2803,7 @@ palmitoyl myristyl serinate: 1
2792
2803
  palmitoyl oligopeptide: 0
2793
2804
  palmitoyl pg-trimonium chloride: 3
2794
2805
  palmitoyl proline: 1
2806
+ palmitoyl tripeptide-5: 0
2795
2807
  panax ginseng: 0
2796
2808
  panicum miliaceum: 0
2797
2809
  panthenol: 0
@@ -3352,6 +3364,7 @@ pei-35: 3
3352
3364
  pei-45: 3
3353
3365
  pei-7: 3
3354
3366
  pei-700: 3
3367
+ pelargonic acid: 1
3355
3368
  pentapotassium triphosphate: 1
3356
3369
  pentasodium aminotrimethylene phosphonate: 3
3357
3370
  pentasodium pentetate: 3
@@ -3404,6 +3417,7 @@ phthalic anhydride/trimellitic anhydride/glycols copolymer: 3
3404
3417
  physalis alkekengi: 0
3405
3418
  phytantriol: 0
3406
3419
  phytic acid: 0
3420
+ phytosterols: 0
3407
3421
  picea excelsa: 0
3408
3422
  picramic acid: 3
3409
3423
  pigment blue: 3
@@ -4013,6 +4027,7 @@ psidium guajava: 0
4013
4027
  psoralea corylifolia: 0
4014
4028
  pterocarpus santalinus: 0
4015
4029
  ptfe: 3
4030
+ pullulan: 0
4016
4031
  pulmonaria officinalis: 0
4017
4032
  pumice: 0
4018
4033
  punica granatum: 0
@@ -4190,7 +4205,7 @@ sesamide dea: 3
4190
4205
  sesamidopropyl betaine: 1
4191
4206
  sesamidopropyl dimethylamine: 2
4192
4207
  sesamidopropylamine oxide: 1
4193
- sesamum indicum: 0
4208
+ sesamum indicum/sesame oil: 0
4194
4209
  shellac: 0
4195
4210
  shellac cera: 0
4196
4211
  shorea stenoptera: 0
@@ -4804,6 +4819,7 @@ theobroma cacao: 0
4804
4819
  theophylline: 0
4805
4820
  thiamine nitrate: 0
4806
4821
  thiodiglycolic acid: 2
4822
+ thiodipropionic acid: 0
4807
4823
  thioglycerin: 2
4808
4824
  thiolactic acid: 2
4809
4825
  thiolanediol: 2
@@ -4839,9 +4855,12 @@ toluene-2,5-diamine sulfate: 4
4839
4855
  toluene-3,4-diamine: 4
4840
4856
  torreya californica: 0
4841
4857
  trachea hydrolysate: 4
4858
+ trehalose: 0
4842
4859
  tri-c12-13 alkyl citrate: 3
4843
4860
  triacetin: 1
4861
+ tribehenin peg-20 esters: 3
4844
4862
  tricalcium phosphate: 0
4863
+ tricaprylin: 1
4845
4864
  triceteareth-4 phosphate: 3
4846
4865
  triceteth-5 phosphate: 3
4847
4866
  trichloroethane: 4
@@ -4884,6 +4903,8 @@ trilaurylamine: 3
4884
4903
  trilinoleic acid: 1
4885
4904
  trilinolein: 1
4886
4905
  trilinolenin: 1
4906
+ trimethylsiloxysilicate: 3
4907
+ tripeptide-29: 1
4887
4908
  triphenyl trimethicone: 4
4888
4909
  tripotassium edta: 4
4889
4910
  trisodium edta: 4
@@ -4902,6 +4923,7 @@ tropaeolum majus: 0
4902
4923
  tuna extract: 4
4903
4924
  turpentine: 3
4904
4925
  tussilago farfara: 0
4926
+ ubiquinone: 2
4905
4927
  ulex europaeus: 0
4906
4928
  ulmus campestris: 0
4907
4929
  ulmus fulva: 0