示例#1
0
    def create_fake_data(cls, binary_class: Optional[str] = None) -> BIODataset:
        data = [
            cls.create_entry(['single'], ['B-Tag'], 0, 1.0),
            cls.create_entry(['single', 'double'], ['B-Tag', 'I-Tag'], 1, 1.0),
            cls.create_entry(['single', 'double', 'triple'], ['B-Tag', 'I-Tag', 'O'], 2, 1.0),
            cls.create_entry(['no_label'], ['O'], 3, 1.0),
        ]

        dataset = BIODataset(0, 'fake_file.txt', binary_class)

        # hack around reading a file
        dataset.data = data

        return dataset
示例#2
0
    def create_fake_data(cls,
                         binary_class: Optional[str] = None) -> BIODataset:
        data = [
            create_entry(['this', 'is', 'an', 'reaction'],
                         ['O', 'O', 'O', 'ADR'], 0),
            create_entry(['this', 'is', 'an', 'reaction', 'an', 'reaction'],
                         ['O', 'O', 'O', 'O', 'O', 'ADR'], 1)
        ]

        dataset = BIODataset(0, 'fake_file.txt', binary_class)

        # hack around reading a file
        dataset.data = data

        return dataset