$ pip install standoffconverter
from lxml import etree
import requests
from standoffconverter import Converter
# 1. download the Macbeth TEI file and convert it to standoff format
url = "https://firstfolio.bodleian.ox.ac.uk/download/xml/F-mac.xml"
response = requests.get(url)
tree = etree.fromstring(response.text.encode('utf-8'))
macbeth = Converter.from_tree(tree)
# 2. create new annotations (automatically) and add them to the original
macbeth.add_annotation(begin, end, "SOMETAG", 0, {attributes})
# 3. store the modified XML
new_tree = macbeth.to_tree()
Cadet
seeks to:
Thank you! ajanco@haverford.edu