Skip to content

Commit

Permalink
feat(verse_stats): lg column für line group
Browse files Browse the repository at this point in the history
  • Loading branch information
thvitt committed Apr 13, 2022
1 parent bd98647 commit 3250165
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions utils/verse_stats.py
Expand Up @@ -69,6 +69,7 @@ class Verse:
element: str # local name of the TEI element representing the line (e.g., l or stage)
is_text: bool # True iff it’s main text
section: str # innermost section number (e.g., 2.3.1 for Faust II, 3rd act, first scene)
lg: str # if line is inside <lg>, n of the respective lg’s first verse
text: str # plain text contents of the line


Expand All @@ -95,6 +96,7 @@ def lines(self):
element=el_t.tag.split('}')[-1],
text=normalize_space(''.join(el_t.xpath('.//text()[not(ancestor::tei:note)]', namespaces=_ns))),
is_text = n.isnumeric() or n.startswith('ttf_'),
lg = first(el_t.xpath('ancestor::tei:lg[1]/tei:l[@n][1]/@n', namespaces=_ns)),
section = first(el_t.xpath('ancestor::tei:div[1]/@n', namespaces=_ns))
)
yield v
Expand Down

0 comments on commit 3250165

Please sign in to comment.