spaCy - Doc.remove_extension Classmethod



As the name implies, this class method will remove a previously registered extension on the Doc class.

Example

An example of Doc.remove_extension classmethod is as follows −

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

Output

False
spacy_containers.htm
Advertisements