Commit c42f8bb5 authored by Neeme Kahusk's avatar Neeme Kahusk

plain style

parent bb6e0047
......@@ -10,12 +10,19 @@ from lxml import etree
def format_line(level: int, element: etree._Element) -> str:
olist = []
ident = 2
style = None
plains = ['SENSE', 'SOURCE_ID', 'WORDNET_OFFSET']
if element.tag in plains:
style = 'plain'
olist.append(ident*level*' ' + str(level))
if element.attrib:
olist.append('@{}@'.format(element.attrib['id']))
olist.append(element.tag)
if element.text and element.text.strip():
olist.append('"{}"'.format(element.text))
if style == 'plain':
olist.append('{}'.format(element.text))
else:
olist.append('"{}"'.format(element.text))
return ' '.join(olist)
......@@ -30,6 +37,8 @@ def rewrite(infilename: str):
print(format_line(level, element))
elif event == 'end':
level -=1
if element.tag == 'WORD_MEANING':
print()
def main():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment