Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseSampleFormatter -- _provide_rows behavior depends on row_ids_provider instance type. #182

Closed
nicolay-r opened this issue Aug 26, 2021 · 0 comments
Assignees
Labels
critical enhancement New feature or request task

Comments

@nicolay-r
Copy link
Owner

According to this part:

def __provide_rows(self, row_dict, parsed_news, linked_wrap, index_in_linked, idle_mode):
"""
Providing Rows depending on row_id_formatter type
"""
assert(isinstance(parsed_news, ParsedNews))
assert(isinstance(row_dict, OrderedDict))
assert(isinstance(linked_wrap, LinkedTextOpinionsWrapper))
origin = linked_wrap.First
if isinstance(self.__row_ids_provider, BinaryIDProvider):
"""
Enumerate all opinions as if it would be with the different label types.
"""
for label in self._label_provider.SupportedLabels:
yield self.__create_row(row=row_dict,
parsed_news=parsed_news,
linked_wrap=self.__copy_modified_linked_wrap(linked_wrap, label),
index_in_linked=index_in_linked,
# TODO. provide uint_label
etalon_label=origin.Sentiment,
idle_mode=idle_mode)
if isinstance(self.__row_ids_provider, MultipleIDProvider):
yield self.__create_row(row=row_dict,
parsed_news=parsed_news,
linked_wrap=linked_wrap,
index_in_linked=index_in_linked,
# TODO. provide uint_label
etalon_label=origin.Sentiment,
idle_mode=idle_mode)
@staticmethod
def __copy_modified_linked_wrap(linked_wrap, label):
assert(isinstance(linked_wrap, LinkedTextOpinionsWrapper))
linked_opinions = [o for o in linked_wrap]
copy = TextOpinion.create_copy(other=linked_opinions[0])
copy.set_label(label=label)
linked_opinions[0] = copy
return LinkedTextOpinionsWrapper(linked_text_opinions=linked_opinions)

It is necessary to separate this and move into other providers, where the one is for BinaryIDType and the other is for MultipleIDType. Every provider should enumerate variants of linked_wraps (with different labels).
Binary type: Multiple linked_wraps
MultipleIDType: single linked_wraps

@nicolay-r nicolay-r added enhancement New feature or request task critical labels Aug 26, 2021
@nicolay-r nicolay-r self-assigned this Aug 26, 2021
nicolay-r added a commit that referenced this issue Dec 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical enhancement New feature or request task
Projects
None yet
Development

No branches or pull requests

1 participant