4 def add_page_to_master(master, ocr_filename):
5 """ Simplest implementation: just dump text to an akap. """
6 with open(ocr_filename) as f:
12 master[-1].tail = (master[-1].tail or '') + '\n\n' + txt + '\n\n'
14 master.text = (master.text or '') + '\n\n' + txt + '\n\n'
17 def add_page_to_master_as_stanzas(master, ocr_filename):
18 """ Simplest implementation: just dump text to an akap. """
19 with open(ocr_filename) as f:
22 strofa = etree.SubElement(master, 'strofa')
24 for piece in txt.split('\n'):
25 if not piece.strip(): continue
26 strofa.text += piece + '/\n'
29 def add_page_to_master_as_p(master, ocr_filename):
30 """ Simplest implementation: just dump text to an akap. """
31 with open(ocr_filename) as f:
34 for piece in txt.strip().split('\n\n'):
35 if not piece.strip(): continue
36 p = etree.SubElement(master, 'akap')