上述问题的代码如下
import spacy
from spacy import displacy
annot_data = [('A Very SoNA Christmas\nView SoNA’s Covid Safety Policies\nSkip to Content\nAbout\nHistory Mission\nStaff Board\nMusic Director\nMusicians\nSoNA Singers\nAuditions\nHire Ensembles\nContact\n2021-22 Season\nSubscriber Series\nTicketed Performances\nSoNA Beyond Series\nVirtual Performances\nVirtual Performances\nSolos from Home\nSpecial Events\nFireworks at the Farm\nReimagined Celebration\nDonate\nGallery\nEducation\nBlog\nOpen Menu\nClose Menu\nAbout\nHistory Mission\nStaff Board\nMusic Director\nMusicians\nSoNA Singers\nAuditions\nHire Ensembles\nContact\n2021-22 Season\nSubscriber Series\nTicketed Performances\nSoNA Beyond Series\nVirtual Performances\nVirtual Performances\nSolos from Home\nSpecial Events\nFireworks at the Farm\nReimagined Celebration\nDonate\nGallery\nEducation\nBlog\nOpen Menu\nClose Menu\nFolder:\nAbout\nFolder:\n2021-22 Season\nSoNA Beyond Series\nFolder:\nVirtual Performances\nFolder:\nSpecial Events\nDonate\nGallery\nEducation\nBlog\nBack\nHistory Mission\nStaff Board\nMusic Director\nMusicians\nSoNA Singers\nAuditions\nHire Ensembles\nContact\nBack\nSubscriber Series\nTicketed Performances\nBack\nVirtual Performances\nSolos from Home\nBack\nFireworks at the Farm\nReimagined Celebration\nA Very SoNA Christmas\nJul 10, 2021\nWritten By SoNA\nSaturday, December 11, 2021 2PM 7:30PM Walton Arts Center, Fayetteville\nA mix of sacred and secular holiday favorites with local guest soloists, The SoNA Singers, and area high school and collegiate choruses. Saturday, December 11, 2021 2PM Matinee Performance Saturday, December 11, 2021 7:30PM Evening Performance\nBuy Tickets\nBuy Tickets\nSingle Tickets: 35, 45, 57 Under 18 FREE with purchase of adult ticket limited quantities Interested in a full season subscription Learn more here . Concert sponsored by Bogle Family Foundation\nWe are committed to ensuring that audiences can experience music safely in person at our performances. Until further notice, patrons, staff, and volunteers are required to wear masks. Learn more about our safety policy here .\nSoNA\nPrevious\nPrevious\nMozart and Beethoven\nNext\nNext\nSoNA Walton Arts Center present The Snowman: A Family Concert\nReceive the latest updates\nEmail Address\nSign Up\nThank you for joining our email list You should receive a verification email shortly to confirm.\nOffice: 479.521.4166 Tickets: 479.443.5600 infosonamusic.org\nCopyright 2021, SoNA. All rights reserved.\nSupport SoNA',
{'entities': [(1958, 1962, 'organization'),
(1230, 1236, 'performance_starttime'),
(1343, 1359, 'organization'),
(1208, 1225, 'performance_date'),
(1237, 1255, 'auditorium'),
(0, 21, 'production_name'),
(1226, 1229, 'performance_starttime')]})]
nlp = spacy.blank('en')
raw_text = annot_data[0][0]
doc = nlp.make_doc(raw_text)
spans = annot_data[0][1]["entities"]
ents = []
for span_start, span_end, label in spans:
ent = doc.char_span(span_start, span_end, label=label)
if ent is None:
continue
ents.append(ent)
doc.ents = ents
displacy.render(doc, style="ent", jupyter=True)