cmudict

package module
v0.0.0-...-51ce4c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2015 License: MIT Imports: 5 Imported by: 2

README

cmudict

Reusable Golang library to provide an API to the CMUDict English pronunciation files

Status

Ready to use

Disclaimer

See The CMU Pronouncing Dictionary for more information about CMUDict. This is a personal project that makes an API available for the use of the CMUDict open-source dictionary, but is not affiliated with Carnegie Mellon or the CMU Pronouncing Dictionary project.

Environment variable

Set the CMUDICT_DATA variable to the path to the data directory of this project. For example:

export CMUDICT_DATA=$HOME/go/src/github.com/BluntSporks/cmudict/data

Programming notes

See abbreviation for a list of abbreviations used.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDictPath

func DefaultDictPath() string

DefaultDictPath gets the CMU dictionary file location from the CMUDICT_DATA environment variable.

func DefaultSymbolPath

func DefaultSymbolPath() string

DefaultSymbolPath gets the CMU symbols file location from the CMUDICT_DATA environment variable.

func FixPhonemes

func FixPhonemes(phonemes []string) []string

FixPhonemes fixes a pronunciation string with custom fixes designed for better phonetic spelling.

func GetPhonemes

func GetPhonemes(pron string, accent bool) []string

GetPhonemes returns the list of phonemes from a string, with or without accents.

func HasAccent

func HasAccent(phoneme string) bool

HasAccent checks if a phoneme has an accent number.

func IsVowel

func IsVowel(phoneme string) bool

IsVowel checks if a phoneme is a vowel, including ER.

func LoadDict

func LoadDict(file string) map[string]string

LoadDict loads the CMU dictionary file and returns it as a map.

func LoadSymbols

func LoadSymbols(file string, accent bool) map[string]bool

LoadSymbols loads the CMU symbols file and returns it as a map. This function removes the vowels symbols without accent numbers.

func StripAccent

func StripAccent(phoneme string) string

StripAccent removes the accent number from a phoneme.

func StripIndex

func StripIndex(word string) string

StripIndex removes the index number in parentheses from the end of a word.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL