-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a mechanism for accepting or rejecting articles (#184)
* Starts with adding html classification * Changes the html classification to be function based * Implements url based filtering for the ndr * Changes the classifier to be optional * Finishes merge with main * Fixes isort * Improves the readability of the article classification and adresses some of the comments from @MaxDall * Adresses the comments from @MaxDall * Fixes a variable name * Updates the typing of the classifier * Moved classification to a new a file and reworked classifier a bit. * added some documentation and switched html/url parameter --------- Co-authored-by: MaxDall <max.dallabetta@googlemail.com>
- Loading branch information
Showing
5 changed files
with
57 additions
and
3 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,9 @@ | ||
import re | ||
from typing import Callable | ||
|
||
|
||
def regex_classifier(regex: str) -> Callable[[str], bool]: | ||
def classify(url: str): | ||
return bool(re.search(regex, url)) | ||
|
||
return classify |
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