Skip to content

Commit

Permalink
Merge pull request #26 from keyoke/keyoke/features
Browse files Browse the repository at this point in the history
remove punc
  • Loading branch information
keyoke authored Sep 20, 2021
2 parents 72de5d3 + d34b566 commit 4a940ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
This extension provides the ability to block duplicate work item creation, similarity between work items is currently determined based on [Dice's Coefficient](http://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient).

Checks are automatically performed on work items of the *same type* and on the following fields :

- Title
- Description

We first check if a work item with a similar **Title** exists, if no similar work item exists we then perform the same checks based on the **Description** field.

Before performing our similarity check we normalize our text:

1. Removing all HTML tags.
2. Removing the following punctuation **!"#$%&'()\*+,-./:;?@[\\]^_`{|}~**.

Similarity is established based on an index 0.0 - 1.0 :
- 0.0 being least similar
- 1.0 being most similar.

By default this extension leverages a similarity index of 0.8.
By default this extension leverages a similarity index of 0.8, in the future threshold will be configurable.

This extension can be leveraged in combination with the [Find similar workitems](https://marketplace.visualstudio.com/items?itemName=tschmiedlechner.find-similar-workitems) extension to establish which work items are similar to the current item.
7 changes: 6 additions & 1 deletion src/block-duplicate-observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,14 @@ class duplicateObserver implements IWorkItemNotificationListener {
}
}

// Remove things we dont want to compare on and ensure comparison based on lower case strings
private normalizeString(orignial_text: string): string {
if (orignial_text)
return striptags(orignial_text).trim().toLowerCase();
return striptags(orignial_text)
.replace(/[.,\/#!$%\^&\*;:{}=\-_`~()]/g,"") // !"#$%&'()*+,-./:;?@[\]^_`{|}~
.replace(/\s{2,}/g," ")
.trim()
.toLowerCase();
else
return "";
}
Expand Down

0 comments on commit 4a940ad

Please sign in to comment.