dwc_agent 0.0.4 → 0.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bf97a06870427012c65b54bd96ddafb67cfab04
4
- data.tar.gz: 47bbc76884b6ecef4fdb926809a31009150b746d
3
+ metadata.gz: d5065b40f8e665968d5731a48192a8d151db10ac
4
+ data.tar.gz: de61ace04702a05a34b306f1713ffc57b4f47e87
5
5
  SHA512:
6
- metadata.gz: 02d5106a1b66bbcbf4ab8caadd669416d6762645b7fcea93d0290bece18f48edc6f6823c0e2e75ea636f7cb3ce6af67093c1161e0832dd1fcd7dbad4e8adff0b
7
- data.tar.gz: 7794ba07bb78fcbdca4bf257fd707fdabe3361b5d32893f9800c465797b77409fbadc5b67de7cb1f650c99083498b9c278359e39adbe38c5404708a8efa9ed6c
6
+ metadata.gz: 91458dd061c722e4cce3a9c3d806acf726a992d4daef8c321b637704feffde0229c4cd282dd25e96f0325b6ef4eaa2910f33b792186c6b9018c0d4397116aad5
7
+ data.tar.gz: 0c95c9fb7d59a7d63eccd97214ecd10a0800821a8d22f14f77c1bc4de7fa584cc665a1deacb8f7ddbdf562e69ae4996b58a09713c520a4804fa074d653a32657
@@ -1,5 +1,5 @@
1
1
  class DwcAgent
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
 
4
4
  def self.version
5
5
  VERSION
data/lib/dwc_agent.rb CHANGED
@@ -270,4 +270,29 @@ class DwcAgent
270
270
  { given: given, family: family }
271
271
  end
272
272
 
273
+ def self.similarity_score(given1, given2)
274
+ given1_parts = given1.gsub(/\.\s+/,".").split(/[\.\s]/)
275
+ given2_parts = given2.gsub(/\.\s+/,".").split(/[\.\s]/)
276
+ largest = [given1_parts,given2_parts].max
277
+ smallest = [given1_parts,given2_parts].min
278
+
279
+ score = 0
280
+ largest.each_with_index do |val,index|
281
+ if smallest[index]
282
+ if val[0] == smallest[index][0]
283
+ score += 1
284
+ else
285
+ return 0
286
+ end
287
+ if val.length > 1 && smallest[index].length > 1 && val != smallest[index]
288
+ return 0
289
+ end
290
+ else
291
+ score += 0.1
292
+ end
293
+ end
294
+
295
+ score
296
+ end
297
+
273
298
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dwc_agent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David P. Shorthouse