-
Notifications
You must be signed in to change notification settings - Fork 37
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 pull request handler and issue handl…
…er (#601) * feat: add skip key words for the issue handler * feat: add skip key words for the pull request handler
- Loading branch information
1 parent
f5443ba
commit 6b31767
Showing
5 changed files
with
42 additions
and
8 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
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 |