spaCy - Span.remove_extension 类方法



顾名思义,此类方法将移除 Span 类中先前注册的一个扩展。

示例

Span.remove_extension 类方法的一个示例如下 −

import spacy
nlp_model = spacy.load("en_core_web_sm")
from spacy.tokens import Span
Span.set_extension('is_city', default=False, force = True)
Removed_ext = Span.remove_extension('is_city')
Span.has_extension('is_city')

输出

执行后,您将收到以下输出 −

False
spacy_container_span_class.htm
广告
© . All rights reserved.