Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Commit

Permalink
bug fix (#5447)
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshitaB authored Oct 25, 2021
1 parent 0d8c0fc commit 1b02227
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,8 @@ def _default_vocabulary_tests(self, data: Optional[Iterable[Tuple]], num_test_ca
nsamples=num_test_cases,
)

_num_entails = len(template.data)

template += self.editor.template(
[
("All {nouns} are {synonyms[0]}.", "Some {nouns} are not {synonyms[0]}."),
Expand All @@ -410,10 +412,12 @@ def _default_vocabulary_tests(self, data: Optional[Iterable[Tuple]], num_test_ca
nsamples=num_test_cases,
)

_num_contradicts = len(template.data) - _num_entails

test = INV(
template.data,
labels=[self._entails for i in range(num_test_cases)]
+ [self._contradicts for i in range(num_test_cases)],
labels=[self._entails for i in range(_num_entails)]
+ [self._contradicts for i in range(_num_contradicts)],
name="Changing X to a synonym(X) should not change the label",
capability="Vocabulary",
description='"Eg. All tigers are huge -> All tigers are enormous" should not change the label',
Expand Down Expand Up @@ -463,6 +467,8 @@ def _default_coreference_tests(
nsamples=_quarter,
)

_num_entails = len(template.data)

template += self.editor.template(
(
"{first_name1} and {first_name2} are friends. The former is {a:profession}.",
Expand All @@ -481,10 +487,12 @@ def _default_coreference_tests(
nsamples=_quarter,
)

_num_neutral = len(template.data) - _num_entails

test = MFT(
**template,
labels=[self._entails for i in range(_quarter * 2)]
+ [self._neutral for i in range(_quarter * 2)],
labels=[self._entails for i in range(_num_entails)]
+ [self._neutral for i in range(_num_neutral)],
name="Former / Latter",
capability="Coreference",
description='Eg. "A and B are friends. The former is a teacher."'
Expand Down

0 comments on commit 1b02227

Please sign in to comment.