示例#1
0
def test_sampa2uni():

    seq = 'tʰɔxtər'
    sampa = eval('"'+sampa2uni('t_hOxt@r')+'"')
    assert sampa == seq #or sampa2 == seq
示例#2
0
 def test_sampa2uni(self):
     seq = 'tʰɔxtər'
     sampa = eval('"' + sampa2uni('t_hOxt@r') + '"')
     assert sampa == seq  # or sampa2 == seq
示例#3
0
for i, line in enumerate(csv[i+1:]):
    if len(line) != 4:
        print('error in line {0} in file {1}'.format(i,'ss'))

    _, concept, language, sampa = line
    if sampa.strip() and sampa.strip() != '-':
        sampa_o = sampa
        sampas = sampa.split(',')
        for sampa in sampas:
            sampa = sampa.strip()
            for s, t in reps:
                sampa = sampa.replace(s, t)
            print(sampa)
            if sampa:
                ipa = sampa2uni(sampa)
                ipa = ipa.replace(' ', '_')
                tks = ipa2tokens(ipa, merge_vowels=False, semi_diacritics='')
                D[idx] = [concept, language, sampa_o, sampa, ipa, tks]
                idx += 1

wl = Wordlist(D)
wl.output('tsv', filename='an-data-wordlist', prettify=False, ignore='all')
lex = LexStat(wl)
print(lex.height, lex.width)
#lex.cluster(method=_method,cluster_method=_cluster_method, threshold=0.45)
lex.cluster(method='sca', threshold=0.45)
alm = Alignments(lex, ref='scaid')
alm.align()
alm.output('tsv', filename='an-data-aligned', prettify=False, ignore='all')
alm.output('html',filename='result')