Basic parser for Finck
First step towards extracting entries from the wordbook in Finck
!pip install parsimonious
from parsimonious.grammar import Grammar
grammar = Grammar(
"""
node = seealso / translation
seealso = italictxt comma ws see ws italictxt fullstop
translation = italictxt fullstop ws german
german = openq qtext closeq
italictxt = italics phntext italics
italics = "*"
see = "s."
comma = ","
fullstop = "."
trscr = ~r"[-æšaiŕəhxkšŕ̥cĺlāl̄ȧēmvńun̄]+"
phntext = ~r'[^\*]+'
qtext = ~r'[^"]+'
num = ~r'[0-9]+'
ref = "St.-B." / "W."
gen = "gen."
ctext = ~r'[^,]+'
openq = "„"
closeq = '"'
ws = ~"\s*"
""")
test = "*ævńəxə*, s. *auən̄*."
test2 = '*ḱŕeȷĭm ə n-æš-aiŕə nə gorp*. „Ich glaube an eine auferstehung des fleisches."'
print(grammar.parse(test2))