Skip to content

Commit

Permalink
Merge pull request #4 from selmi-karim/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
selmi-karim authored May 30, 2020
2 parents f62ec3d + c259e54 commit 7d0911e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [1.1.1](https://github.com/selmi-karim/dice-similarity-coeff/compare/v1.1.0...v1.1.1) (2020-05-30)


### Bug Fixes

* check char strings ([4e52b05](https://github.com/selmi-karim/dice-similarity-coeff/commit/4e52b0594e747f8e99548b53c7b460d053baf273))

# [1.1.0](https://github.com/selmi-karim/dice-similarity-coeff/compare/v1.0.3...v1.1.0) (2020-05-30)


Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const twoStrings = (sa1, sa2) => {
// Comparison should not check case or whitespace
let s1 = sa1.replace(/\s/g, "").toLowerCase();
let s2 = sa2.replace(/\s/g, "").toLowerCase();

if(s1.length === 1 || s2.length === 1) return Number(s1 === s2)
const similarity_num = 2 * intersect(pairs(s1), pairs(s2)).length;
const similarity_den = pairs(s1).length + pairs(s2).length;
return similarity_num / similarity_den;
Expand Down
2 changes: 1 addition & 1 deletion index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const dsc = require("./index");

/** Comparing 2 exact same strings returns 1 */
test("matching two equal strings", () => {
expect(dsc.twoStrings("hello world", "hello world")).toBe(1);
expect(dsc.twoStrings("a", "a")).toBe(1);
});

/** Comparing 2 different strings returns ]0,1[ */
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dice-similarity-coeff",
"version": "1.1.0",
"version": "1.1.1",
"description": "Find similarity between two strings, based on Dice Similarity Coefficient DSC",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 7d0911e

Please sign in to comment.