-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from wangyuxinwhy/fix-infer-record-type
🐞fix:infer record type bug
- Loading branch information
Showing
6 changed files
with
45 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "uniem" | ||
version = "0.2.2" | ||
version = "0.2.3" | ||
description = "unified embedding model" | ||
authors = ["wangyuxin <[email protected]>"] | ||
license = "MIT" | ||
|
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,31 @@ | ||
import pytest | ||
from uniem.data_structures import RecordType, infer_record_type | ||
|
||
|
||
@pytest.mark.parametrize( | ||
'record, expected_record_type', | ||
[ | ||
pytest.param( | ||
{'text': 'I like apples', 'text_pos': 'I like oranges'}, | ||
RecordType.PAIR, | ||
id='pair', | ||
), | ||
pytest.param( | ||
{'text': 'I like apples', 'text_pos': 'I like oranges', 'source': 'wikipedia'}, | ||
RecordType.PAIR, | ||
id='pair_with_extra_fields', | ||
), | ||
pytest.param( | ||
{'text': 'I like apples', 'text_pos': 'I like oranges', 'text_neg': 'I want to eat apples'}, | ||
RecordType.TRIPLET, | ||
id='triplet', | ||
), | ||
pytest.param( | ||
{'sentence1': 'I like apples', 'sentence2': 'I like oranges', 'label': 1.0}, | ||
RecordType.SCORED_PAIR, | ||
id='scored_pair', | ||
), | ||
], | ||
) | ||
def test_infer_record_type(record: dict, expected_record_type: RecordType): | ||
assert infer_record_type(record) == expected_record_type |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.1.1' | ||
__version__ = '0.2.3' |