|
|
|
@ -204,23 +204,36 @@ def file_sentence_generator(et, args):
|
|
|
|
|
words[sentence.get('id')] = Word.fake_root_word(sentence.get('id'))
|
|
|
|
|
last_word_id = None
|
|
|
|
|
|
|
|
|
|
for w in sentence.iter():
|
|
|
|
|
if w.tag == 'w':
|
|
|
|
|
words[w.get('id')] = Word.from_xml(w, do_msd_translate)
|
|
|
|
|
if use_punctuations:
|
|
|
|
|
previous_glue = ''
|
|
|
|
|
last_word_id = None
|
|
|
|
|
elif w.tag == pc_tag:
|
|
|
|
|
words[w.get('id')] = Word.pc_word(w, do_msd_translate)
|
|
|
|
|
if use_punctuations:
|
|
|
|
|
last_word_id = w.get('id')
|
|
|
|
|
words[w.get('id')].previous_glue = previous_glue
|
|
|
|
|
previous_glue = ''
|
|
|
|
|
elif use_punctuations and w.tag == 'c':
|
|
|
|
|
# always save previous glue
|
|
|
|
|
previous_glue = w.text
|
|
|
|
|
if last_word_id:
|
|
|
|
|
words[last_word_id].glue += w.text
|
|
|
|
|
if args.new_tei:
|
|
|
|
|
for w in sentence.iter():
|
|
|
|
|
if w.tag == 'w':
|
|
|
|
|
words[w.get('id')] = Word.from_xml(w, do_msd_translate)
|
|
|
|
|
if use_punctuations:
|
|
|
|
|
previous_glue = '' if 'join' in w.attrib and w.get('join') == 'right' else ' '
|
|
|
|
|
elif w.tag == pc_tag:
|
|
|
|
|
words[w.get('id')] = Word.pc_word(w, do_msd_translate)
|
|
|
|
|
if use_punctuations:
|
|
|
|
|
words[w.get('id')].previous_glue = previous_glue
|
|
|
|
|
words[w.get('id')].glue = '' if 'join' in w.attrib and w.get('join') == 'right' else ' '
|
|
|
|
|
previous_glue = '' if 'join' in w.attrib and w.get('join') == 'right' else ' '
|
|
|
|
|
else:
|
|
|
|
|
for w in sentence.iter():
|
|
|
|
|
if w.tag == 'w':
|
|
|
|
|
words[w.get('id')] = Word.from_xml(w, do_msd_translate)
|
|
|
|
|
if use_punctuations:
|
|
|
|
|
previous_glue = ''
|
|
|
|
|
last_word_id = None
|
|
|
|
|
elif w.tag == pc_tag:
|
|
|
|
|
words[w.get('id')] = Word.pc_word(w, do_msd_translate)
|
|
|
|
|
if use_punctuations:
|
|
|
|
|
last_word_id = w.get('id')
|
|
|
|
|
words[w.get('id')].previous_glue = previous_glue
|
|
|
|
|
previous_glue = ''
|
|
|
|
|
elif use_punctuations and w.tag == 'c':
|
|
|
|
|
# always save previous glue
|
|
|
|
|
previous_glue = w.text
|
|
|
|
|
if last_word_id:
|
|
|
|
|
words[last_word_id].glue += w.text
|
|
|
|
|
|
|
|
|
|
# for w in sentence.iter("w"):
|
|
|
|
|
# words[w.get('id')] = Word.from_xml(w, do_msd_translate)
|
|
|
|
|