Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell98 |
Arpabet phoneme definitions and CMU dictionary functions.
http://www.speech.cs.cmu.edu/cgi-bin/cmudict http://en.wikipedia.org/wiki/Arpabet
- data Stress
- data Phoneme
- type Phoneme_str = (Phoneme, Maybe Stress)
- type SYLLABLE = [Phoneme_str]
- type ARPABET = [Phoneme_str]
- type ARPABET_syl = [SYLLABLE]
- type CMU_Dict_ty a = Map String a
- type CMU_Dict = CMU_Dict_ty ARPABET
- type CMU_Dict_syl = CMU_Dict_ty ARPABET_syl
- parse_phoneme_str :: String -> Phoneme_str
- parse_arpabet :: String -> (String, ARPABET)
- parse_arpabet_syl :: String -> (String, ARPABET_syl)
- data Phoneme_Class
- = Monophthong
- | Diphthong
- | R_Coloured
- | Semivowel
- | Stop
- | Affricate
- | Fricative
- | Aspirate
- | Nasal
- | Liquid
- arpabet_classification_table :: [(Phoneme_Class, [Phoneme])]
- arpabet_classification :: Phoneme -> Phoneme_Class
- cmudict_load_ty :: (String -> (String, a)) -> FilePath -> IO (CMU_Dict_ty a)
- cmudict_load :: FilePath -> IO CMU_Dict
- cmudict_syl_load :: FilePath -> IO CMU_Dict_syl
- d_lookup :: CMU_Dict_ty a -> String -> Maybe a
- d_lookup' :: CMU_Dict_ty a -> String -> Either String a
- arpabet_ipa_table :: [(Phoneme, Either String [(Stress, String)])]
- phoneme_ipa :: Maybe Stress -> Phoneme -> String
- arpabet_ipa :: ARPABET -> String
Documentation
Stress indicators, placed at the stressed syllabic vowel.
Arpabet phonemes as used at CMU dictionary.
[AO .. NX] == [minBound .. maxBound] length [AO .. NX] == 48
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)
parse_arpabet :: String -> (String, ARPABET) Source
parse_arpabet_syl :: String -> (String, ARPABET_syl) Source
data Phoneme_Class Source
Classification of Phoneme
s.
arpabet_classification_table :: [(Phoneme_Class, [Phoneme])] Source
Classification table for Phoneme
.
arpabet_classification :: Phoneme -> Phoneme_Class Source
Consult arpabet_classification_table
.
arpabet_classification HH == Aspirate map arpabet_classification [minBound .. maxBound]
cmudict_load_ty :: (String -> (String, a)) -> FilePath -> IO (CMU_Dict_ty a) Source
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"