-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
36 additions
and
70 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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,18 @@ | ||
from arekit.common.data.input.providers.label.multiple import MultipleLabelProvider | ||
from arekit.common.data.input.providers.rows.samples import BaseSampleRowProvider | ||
from arekit.common.data.input.providers.text.single import BaseSingleTextProvider | ||
from arekit.common.data.input.terms_mapper import OpinionContainingTextTermsMapper | ||
from arekit.contrib.bert.input.providers.text_pair import PairTextProvider | ||
|
||
|
||
def create_sample_provider(label_scaler, text_b_template, text_terms_mapper, text_b_labels_fmt=None): | ||
assert(isinstance(text_terms_mapper, OpinionContainingTextTermsMapper)) | ||
|
||
text_provider = BaseSingleTextProvider(text_terms_mapper=text_terms_mapper) \ | ||
if text_b_labels_fmt is None else PairTextProvider(text_b_template=text_b_template, | ||
text_b_labels_fmt=text_b_labels_fmt, | ||
text_terms_mapper=text_terms_mapper) | ||
|
||
label_provider = MultipleLabelProvider(label_scaler=label_scaler) | ||
|
||
return BaseSampleRowProvider(text_provider=text_provider, label_provider=label_provider) |
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,18 @@ | ||
from enum import Enum | ||
|
||
|
||
class BertTextBTemplates(Enum): | ||
""" | ||
Default, based on COLA, but includes an extra text_b. | ||
text_b: Pseudo-sentence w/o S.P (S.P -- sentiment polarity) | ||
text_b: Question w/o S.P (S.P -- sentiment polarity) | ||
Multilabel variant | ||
Notation were taken from paper: | ||
https://www.aclweb.org/anthology/N19-1035.pdf | ||
""" | ||
|
||
NLI = '{subject} к {object} в контексте : << {context} >>' | ||
|
||
QA = 'Что вы думаете по поводу отношения {subject} к {object} в контексте : << {context} >> ?' |