Skip to content

Commit

Permalink
Update spacy.gold to offsets_to_biluo_tags
Browse files Browse the repository at this point in the history
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](doccano#35)
  • Loading branch information
henrique-voni authored Apr 18, 2023
1 parent 19ad77c commit dccfb7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doccano_transformer/examples.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit dccfb7c

Please sign in to comment.