mirror of
https://github.com/iv-org/close-potential-duplicates.git
synced 2024-11-26 23:50:43 +00:00
refactor: ♻️ format of threshold
This commit is contained in:
parent
2bfd89ddd8
commit
bd25c96c13
@ -4,7 +4,6 @@
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
Create `.github/workflows/potential-duplicates.yml` in the default branch:
|
||||
|
||||
```yaml
|
||||
@ -23,12 +22,11 @@ jobs:
|
||||
label: potential-duplicate
|
||||
# Get issues with state to compare. Supported state: 'all', 'closed', 'open'.
|
||||
state: all
|
||||
# If similarity is higher than this threshold, issue will be marked as duplicate.
|
||||
# If similarity is higher than this threshold([0,1]), issue will be marked as duplicate.
|
||||
threshold: 0.6
|
||||
# Comment to post when potential duplicates are detected.
|
||||
comment: >
|
||||
Potential duplicates:
|
||||
{{#issues}}
|
||||
Potential duplicates: {{#issues}}
|
||||
- [#{{ number }}] {{ title }} ({{ accuracy }}%)
|
||||
{{/issues}}
|
||||
```
|
||||
|
@ -23,13 +23,17 @@ export namespace Action {
|
||||
for (const issue of issues) {
|
||||
const accuracy = Algo.compare(issue.title, title)
|
||||
|
||||
core.debug(`${issue.title} ~ ${title} = ${accuracy}`)
|
||||
core.debug(
|
||||
`${issue.title} ~ ${title} = ${parseFloat(
|
||||
(accuracy * 100).toFixed(2),
|
||||
)}%`,
|
||||
)
|
||||
|
||||
if (accuracy >= threshold) {
|
||||
duplicates.push({
|
||||
number: issue.number,
|
||||
title: issue.title,
|
||||
accuracy: Math.round(accuracy * 100),
|
||||
accuracy: parseFloat((accuracy * 100).toFixed(2)),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
12
src/dic.ts
12
src/dic.ts
@ -1,23 +1,29 @@
|
||||
export namespace Dic {
|
||||
export const excludes = [
|
||||
'at',
|
||||
'under',
|
||||
'about',
|
||||
'the',
|
||||
'and',
|
||||
'a',
|
||||
'an',
|
||||
'as',
|
||||
'at',
|
||||
'are',
|
||||
'by',
|
||||
'from',
|
||||
'when',
|
||||
'well',
|
||||
'is',
|
||||
'are',
|
||||
'was',
|
||||
'it',
|
||||
'in',
|
||||
'to',
|
||||
'till',
|
||||
'until',
|
||||
'or',
|
||||
'by',
|
||||
'with',
|
||||
'on',
|
||||
'in',
|
||||
'into',
|
||||
'outo',
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user