-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathipa_easy_writer.py
More file actions
71 lines (64 loc) · 1.34 KB
/
ipa_easy_writer.py
File metadata and controls
71 lines (64 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!coding: utf-8
from __future__ import print_function
def print_info():
import unicodedata
r = '''
\u028a \u026a \u00f8 \u025b \u0153 \u00e6 \u0259 \u025c \u0254 \u0251
\u0283 \u0292 \u0280 \u0281 \u028c
\u0272 \u0265
\u014b
'''.strip()
print(r)
print(' '.join(x + '\u0303' for x in '\u0251\u025B\u0153\u0254'))
for x in r.split():
print('U+' + hex(ord(x))[2:].zfill(4).upper(), x, unicodedata.name(x))
if __name__ == '__main__':
print_info()
class Dict:
def __init__(self, dic):
self.dic = dic
def word(self, w):
return '/{}/'.format(''.join(self.dic.get(x, x) for x in w.split()))
__call__ = word
french = Dict({
'e':'ə',
'é':'e',
'è':'ɛ',
'ê':'ɛː',
'oe':'œ',
'eu':'ø',
'o':'ɔ',
'ô':'o',
'au':'o',
'ou':'u',
'u':'y',
'â':'ɑ',
# useless accents
'ù': 'y',
'î': 'i',
'û': 'y',
# nasals
'in':'ɛ\u0303',
'ain':'ɛ\u0303',
'ein':'ɛ\u0303',
'un':'œ\u0303',
'on':'ɔ\u0303',
'on':'ɔ\u0303',
'an':'ɑ\u0303',
# consonants
'r': 'ʁ',
'ch': 'ʃ',
'j': 'ʒ',
'gn': 'ɲ',
# semivowels
'ui': 'ɥ',
'y': 'j',
# punctuation
':': 'ː',
'--': '‿',
# probable error
'c': '?k,s?',
'h': '??',
'q': '?k?',
'x': '?ks?',
})