-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add skip key words for the issue handler
- Loading branch information
1 parent
f5443ba
commit 5e02b36
Showing
3 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import difflib | ||
|
||
|
||
def contains_keyword_fuzzy(text, keywords, cutoff=0.8): | ||
text_lower = text.lower() | ||
for keyword in keywords: | ||
keyword_lower = keyword.lower() | ||
len_keyword = len(keyword_lower) | ||
|
||
for i in range(len(text_lower) - len_keyword + 1): | ||
substring = text_lower[i : i + len_keyword] | ||
matcher = difflib.SequenceMatcher(None, keyword_lower, substring) | ||
if matcher.ratio() >= cutoff: | ||
return True | ||
return False |