hsc3-lang-0.15: Haskell SuperCollider Language

Safe HaskellSafe-Inferred
LanguageHaskell98

Sound.SC3.Lang.Data.CMUdict

Contents

Description

Arpabet phoneme definitions and CMU dictionary functions.

http://www.speech.cs.cmu.edu/cgi-bin/cmudict http://en.wikipedia.org/wiki/Arpabet

Synopsis

Documentation

data Stress Source

Stress indicators, placed at the stressed syllabic vowel.

data Phoneme Source

Arpabet phonemes as used at CMU dictionary.

[AO .. NX] == [minBound .. maxBound]
length [AO .. NX] == 48

Constructors

AO 
AA 
IY 
UW 
EH 
IH 
UH 
AH 
AX 
AE 
EY 
AY 
OW 
AW 
OY 
ER 
AXR 
Y 
W 
Q 
P 
B 
T 
D 
K 
G 
CH 
JH 
F 
V 
TH 
DH 
S 
Z 
SH 
ZH 
HH 
M 
EM 
N 
EN 
NG 
ENG 
L 
EL 
R 
DX 
NX 

type SYLLABLE = [Phoneme_str] Source

There is a variant CMU dictionary with syllable marks. http://webdocs.cs.ualberta.ca/~kondrak/cmudict.html

type ARPABET = [Phoneme_str] Source

An ARPABET word.

type ARPABET_syl = [SYLLABLE] Source

An ARPABET word, with syllables.

type CMU_Dict_ty a = Map String a Source

Parameterised CMU dictionary.

type CMU_Dict = CMU_Dict_ty ARPABET Source

The CMU dictionary.

type CMU_Dict_syl = CMU_Dict_ty ARPABET_syl Source

The syllabic CMU dictionary.

parse_phoneme_str :: String -> Phoneme_str Source

Parse Phoneme_str

parse_phoneme_str "EY1" == (EY,Just Primary_stress)
parse_phoneme_str "R" == (R,Nothing)

arpabet_classification :: Phoneme -> Phoneme_Class Source

Consult arpabet_classification_table.

arpabet_classification HH == Aspirate
map arpabet_classification [minBound .. maxBound]

cmudict_load :: FilePath -> IO CMU_Dict Source

Load CMU dictionary from file.

d <- cmudict_load "/home/rohan/data/cmudict/cmudict.0.7a"
M.size d == 133313

cmudict_syl_load :: FilePath -> IO CMU_Dict_syl Source

Load syllable CMU dictionary from file.

d <- cmudict_syl_load "/home/rohan/data/cmudict/cmudict.0.6d.syl"
M.size d == 129463

d_lookup :: CMU_Dict_ty a -> String -> Maybe a Source

Dictionary lookup.

let r = [(R,Nothing),(EY,Just Primary_stress)
        ,(N,Nothing),(ER,Just No_stress),(D,Nothing)]
in d_lookup d "reynard" == Just r

d_lookup' :: CMU_Dict_ty a -> String -> Either String a Source

Variant that retains query string if not in dictionary.

IPA

arpabet_ipa_table :: [(Phoneme, Either String [(Stress, String)])] Source

Table mapping Arpabet phonemes to IPA strings.

length arpabet_ipa_table == 48

phoneme_ipa :: Maybe Stress -> Phoneme -> String Source

Consult arpabet_ipa_table.

map (phoneme_ipa (Just Primary_stress)) [minBound .. maxBound]

arpabet_ipa :: ARPABET -> String Source

Consult arpabet_ipa_table.

let r = map parse_phoneme_str (words "R EY1 N ER0 D")
in arpabet_ipa r == "ɹeɪnɝd"