Esempio n. 1
0
def changeSyntaticToPhonetic(xml):
    lexicon = xml.getroot()
    for lemma in lexicon.getiterator('lemma'):
	if lemma.get('special'): continue
	phon = lemma.find('phon')
	if phon is not None:
	    phon = phon.text.split()
	    phon.append('#1')
	synt = lemma.find('synt')
	if synt is None:
	    synt = SubElement(lemma, 'synt')
	else:
	    synt.clear()
	synt.tail = '\n  '
	if phon:
	    for ph in phon:
		SubElement(synt, 'tok').text = ph
Esempio n. 2
0
def changeSyntaticToPhonetic(xml):
    lexicon = xml.getroot()
    for lemma in lexicon.getiterator('lemma'):
	if lemma.get('special'): continue
	phon = lemma.find('phon')
	if phon is not None:
	    phon = phon.text.split()
	    phon.append('#1')
	synt = lemma.find('synt')
	if synt is None:
	    synt = SubElement(lemma, 'synt')
	else:
	    synt.clear()
	synt.tail = '\n  '
	if phon:
	    for ph in phon:
		SubElement(synt, 'tok').text = ph
Esempio n. 3
0
def changeSyntaticToPhonetic(xml):
    lexicon = xml.getroot()
    for lemma in lexicon.getiterator("lemma"):
        if lemma.get("special"):
            continue
        phon = lemma.find("phon")
        if phon is not None:
            phon = phon.text.split()
            phon.append("#1")
        synt = lemma.find("synt")
        if synt is None:
            synt = SubElement(lemma, "synt")
        else:
            synt.clear()
        synt.tail = "\n  "
        if phon:
            for ph in phon:
                SubElement(synt, "tok").text = ph