This commit is contained in:
lkrsnik 2018-05-31 15:54:38 +02:00
commit ba84f30386
2 changed files with 6 additions and 3 deletions

View File

@ -134,7 +134,7 @@ with open("data/new_sloleks/final_sloleks.xml", "ab") as myfile:
new_element = etree.Element('feat')
new_element.attrib['att'] = 'SAMPA'
new_element.attrib['val'] = result = convert_to_SAMPA(accentuated_word)
new_element.attrib['val'] = convert_to_SAMPA(accentuated_word)
wf.append(new_element)
word_glob_num += 1

View File

@ -157,7 +157,7 @@ def convert_to_SAMPA(word):
next_letter_i = 1
if word[0] == '\"':
letter_i = 1
if word[2] == ':':
if len(word) > 2 and word[2] == ':':
if len(word) > 3:
next_letter_i = 3
else:
@ -167,7 +167,10 @@ def convert_to_SAMPA(word):
# word[next_letter_i] = 'n\''
return ''.join(word)
else:
if len(word) > 2:
next_letter_i = 2
else:
return ''.join(word)
elif len(word) > 1 and word[1] == '\"':
next_letter_i = 2
# {('m', 'f'): 'F'}