56 lines
717 B
Python
56 lines
717 B
Python
#!/usr/bin/env python3
|
|
|
|
"""
|
|
Convert ARPABET <http://www.speech.cs.cmu.edu/cgi-bin/cmudict>
|
|
to Apple's codes <https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/SpeechSynthesisProgrammingGuide/Phonemes/Phonemes.html>
|
|
"""
|
|
|
|
import sys
|
|
|
|
|
|
mapping = {s.split()[0]: s.split()[1] for s in """
|
|
AA AA
|
|
AE AE
|
|
AH UX
|
|
AO AO
|
|
AW AW
|
|
AY AY
|
|
B b
|
|
CH C
|
|
D d
|
|
DH D
|
|
EH EH
|
|
ER UXr
|
|
EY EY
|
|
F f
|
|
G g
|
|
HH h
|
|
IH IH
|
|
IY IY
|
|
JH J
|
|
K k
|
|
L l
|
|
M m
|
|
N n
|
|
NG N
|
|
OW OW
|
|
OY OY
|
|
P p
|
|
R r
|
|
S s
|
|
SH S
|
|
T t
|
|
TH T
|
|
UH UH
|
|
UW UW
|
|
V v
|
|
W w
|
|
Y y
|
|
Z z
|
|
ZH Z
|
|
""".strip().split('\n')}
|
|
|
|
arpabet_phonemes = sys.stdin.read().split()
|
|
apple_phonemes = [mapping[p.upper()] for p in arpabet_phonemes]
|
|
print('[[inpt PHON]] ' + ''.join(apple_phonemes))
|