From dccfb7c686148e7b5bac1cd28615b6916e07cd14 Mon Sep 17 00:00:00 2001 From: Henrique Voni Date: Tue, 18 Apr 2023 12:51:26 -0300 Subject: [PATCH] Update spacy.gold to offsets_to_biluo_tags This suggestion updates the `spacy` methods in order to use latest package version available. According to [this documentation](https://spacy.io/usage/v3), `spacy.gold` was replaced by `spacy.training` with different method signatures. This issue was already mentioned [here](https://github.com/doccano/doccano-transformer/issues/35) --- doccano_transformer/examples.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doccano_transformer/examples.py b/doccano_transformer/examples.py index cdf7abc..8c82924 100644 --- a/doccano_transformer/examples.py +++ b/doccano_transformer/examples.py @@ -1,7 +1,7 @@ from collections import defaultdict from typing import Callable, Iterator, List, Optional -from spacy.gold import biluo_tags_from_offsets +from spacy.training import offsets_to_biluo_tags from doccano_transformer import utils @@ -98,7 +98,7 @@ def to_spacy( tokens = utils.convert_tokens_and_offsets_to_spacy_tokens( tokens, offsets ) - tags = biluo_tags_from_offsets(tokens, label) + tags = offsets_to_biluo_tags(tokens, label) tokens_for_spacy = [] for i, (token, tag, offset) in enumerate( zip(tokens, tags, offsets)