spacy (nlp.make_doc(text), entities)` to check the alignment. Misaligned entities ('-') will be ignored during training.

https://www.cnpython.com/qa/1301944

 Use `spacy.gold.biluo_tags_from_offsets(nlp.make_doc(text), entities)` to check the alignment. Misaligned entities ('-') will be ignored during training.
TRAIN_DATA = [
    ("XYZxyzg hat die beste Camera für Selfies", {"entities": [(0, 7, "BRAND"), (23, 28, "CAMERA")]}),
]

实体偏移需要与标记边界对齐。不能在令牌的中间启动/结束实体。在您的例子中,似乎出现了一个小错误,第二个实体的偏移量应该是(22, 28, "CAMERA")

中文也一样

posted @ 2022-06-26 16:52  付玬熙  阅读(95)  评论(0编辑  收藏  举报