forked from GurjotSinghMahi/PUNJABI-IPA-CONVERTER
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conversion_func.py
81 lines (78 loc) · 2.98 KB
/
conversion_func.py
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
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
def ipa_creation(word):
word = re.sub(r"ਆ", "ɑː", word)
word = re.sub(r"ਪਾ", "ɑː", word)
word = re.sub(r"ਬ", "b", word)
word = re.sub(r"ਭ", "bʰ", word)
word = re.sub(r"ਚ", "c", word)
word = re.sub(r"ਛ", "cʰ", word)
word = re.sub(r"ਔ", "ɔː", word)
word = re.sub(r"ਪੌ", "ɔː", word)
word = re.sub(r"ਦ", "d", word)
word = re.sub(r"ਧ", "dʰ", word)
word = re.sub(r"ਡ", "ɖ", word)
word = re.sub(r"ਢ", "ɖʰ", word)
word = re.sub(r"ਅ", "ə", word)
word = re.sub(r"ਏ", "eː", word)
word = re.sub(r"ਪੇ", "eː", word)
word = re.sub(r"ਐ", "ɛː", word)
word = re.sub(r"ਪੈ", "ɛː", word)
word = re.sub(r"ਫ਼", "f", word)
word = re.sub(r"ਗ", "ɡ", word)
word = re.sub(r"ਘ", "gʰ", word)
word = re.sub(r"ਹ", "h", word)
word = re.sub(r"ਈ", "iː", word)
word = re.sub(r"ਇ", "ɪ", word)
word = re.sub(r"ਪੀ", "iː", word)
word = re.sub(r"ਪਿ", "ɪ", word)
word = re.sub(r"ਜ", "j", word)
word = re.sub(r"ਝ", "jʰ", word)
word = re.sub(r"ਜ਼", "jͣ", word)
word = re.sub(r"ਕ", "k", word)
word = re.sub(r"ਖ", "kʰ", word)
word = re.sub(r"ਲ", "l", word)
word = re.sub(r"ਮ", "m", word)
word = re.sub(r"ਨ", "n", word)
word = re.sub(r"ਞ", "n", word)
word = re.sub(r"ਣ", "ɳ", word)
word = re.sub(r"ਪੋ", "oː", word)
word = re.sub(r"ਓ", "oː", word)
word = re.sub(r"ਪ", "p", word)
word = re.sub(r"ਫ", "pʰ", word)
word = re.sub(r"ਰ", "r", word)
word = re.sub(r"ੜ", "ɽ", word)
word = re.sub(r"ੜ੍ਹ", "ɽʱ", word)
word = re.sub(r"ਸ", "s", word)
word = re.sub(r"ਸ਼", "ʃ", word)
word = re.sub(r"ਤ", "t", word)
word = re.sub(r"ਥ", "tʰ", word)
word = re.sub(r"ਟ", "ʈ", word)
word = re.sub(r"ਠ", "ʈʰ", word)
word = re.sub(r"ਪੂ", "uː", word)
word = re.sub(r"ਊ", "uː", word)
word = re.sub(r"ਪੁ", "ʊ", word)
word = re.sub(r"ਉ", "ʊ", word)
word = re.sub(r"ਵ", "v", word)
word = re.sub(r"ਕ਼", "q", word)
word = re.sub(r"ਖ਼", "x", word)
word = re.sub(r"ਯ", "y", word)
word = re.sub(r"ਗ਼", "ɣ", word)
word = re.sub(r"ਜ਼", "z", word)
word = re.sub(r"ं", "ŋ", word)
word = re.sub(r"ਂ", "ŋ", word)
word = re.sub(r"੍ਰ", "ʳ", word)
word = re.sub(r"੍ਹ", "ʰ", word)
word = re.sub(r"ੰ", " ̃", word)
word = re.sub(r"ਿ", "ɪ", word)
word = re.sub(r"ੀ", "iː", word)
word = re.sub(r"ੇ", "eː", word)
word = re.sub(r"ੈ", "ɛː", word)
word = re.sub(r"ੋ", "oː", word)
word = re.sub(r"ੌ", "ɔː", word)
word = re.sub(r"ਾ", "ɑː", word)
word = re.sub(r"ੁ", "ʊ", word)
word = re.sub(r"ੂ", "uː", word)
word = re.sub(r"ੱ", "a", word)
return word