-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#66 support filtering for relation types
- Loading branch information
Showing
10 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
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,13 @@ | ||
from arekit.common.text_opinions.base import TextOpinion | ||
from arekit.contrib.utils.pipelines.text_opinion.filters.base import TextOpinionFilter | ||
|
||
|
||
class LabelTextOpinionFilter(TextOpinionFilter): | ||
|
||
def __init__(self, relation_types): | ||
assert(isinstance(relation_types, list)) | ||
self.__relation_types = set(relation_types) | ||
|
||
def filter(self, text_opinion, parsed_doc, entity_service_provider): | ||
assert(isinstance(text_opinion, TextOpinion)) | ||
return type(text_opinion.Label).__name__ in self.__relation_types |
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,13 @@ | ||
from arekit.common.text_opinions.base import TextOpinion | ||
from arekit.contrib.utils.pipelines.text_opinion.filters.base import TextOpinionFilter | ||
|
||
|
||
class ObjectOpinionFilter(TextOpinionFilter): | ||
|
||
def __init__(self, relation_types): | ||
assert(isinstance(relation_types, list)) | ||
self.__relation_types = set(relation_types) | ||
|
||
def filter(self, text_opinion, parsed_doc, entity_service_provider): | ||
assert(isinstance(text_opinion, TextOpinion)) | ||
return type(text_opinion.Label).__name__ in self.__relation_types |
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
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