Package pyTTS :: Module Pronounce :: Class Pronounce
[show private | hide private]
[frames | no frames]

Type Pronounce

object --+
         |
        Pronounce


Corrects pronunciation of speech synthesized words.
Method Summary
  __init__(self, filename)
Initialize an instance of the class.
boolean AddMisspelled(self, word, pron)
Add a mispelling of a word as a correction to the the dictionary.
boolean AddPhonetic(self, word, pron)
Add a phonetic pronunciation to the dictionary.
string Correct(self, text)
Parse a text string and correct it for pronunciation according to the rules of the currently loaded dictionary.
  CorrectNow(cls, word, pron, type)
Correct the given word with the given pronunciation immediately. (Class method)
2-tuple of int, string GetPronunciation(self, word)
Return pronunciation text and type associated with the given word
list ListWords(self)
Return all words in the dictionary
  New(self)
Start a new dictionary.
  Open(self, filename)
Load a dictionary from disk.
  RemoveWord(self, word)
Remove a word from the dictionary.
  Save(self, filename)
Save a dictionary to disk.
Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Instance Variable Summary
dictionary dictionary: Dictionary of words and their correction/correction type pairings
Translator trans: Parser that replaces words with their corrections if found

Instance Method Details

__init__(self, filename=None)
(Constructor)

Initialize an instance of the class. Load a dictionary immediately from a file if on is given.
Parameters:
filename - Name of the dictionary file to load
           (type=string)
Overrides:
__builtin__.object.__init__

AddMisspelled(self, word, pron)

Add a mispelling of a word as a correction to the the dictionary.
Parameters:
word - Word spelled correctly
           (type=string)
pron - Word mispelled to sound correct
           (type=string)
Returns:
Flag indicating if word is already in the dictionary
           (type=boolean)

AddPhonetic(self, word, pron)

Add a phonetic pronunciation to the dictionary. See the SAPI documentation for allowed phonetic symbols and stress marks.
Parameters:
word - Word spelled correctly
           (type=string)
pron - Pronunciation of the word consisting of phenomes
           (type=string)
Returns:
Flag indicating if word is already in the dictionary
           (type=boolean)

Correct(self, text)

Parse a text string and correct it for pronunciation according to the rules of the currently loaded dictionary.
Parameters:
text - Text to correct for pronunciation
           (type=string)
Returns:
Corrected text
           (type=string)

GetPronunciation(self, word)

Returns:
Pronunciation text and type associated with the given word
           (type=2-tuple of int, string)

ListWords(self)

Returns:
All words in the dictionary
           (type=list)

New(self)

Start a new dictionary.

Open(self, filename)

Load a dictionary from disk.
Parameters:
filename - Name of the dictionary file to load
           (type=string)

RemoveWord(self, word)

Remove a word from the dictionary.
Parameters:
word - Word to remove

Save(self, filename)

Save a dictionary to disk.
Parameters:
filename - Name of the dictionary file to save
           (type=string)

Class Method Details

CorrectNow(cls, word, pron, type=0)

Correct the given word with the given pronunciation immediately.
Parameters:
word - Word to correct
           (type=string)
pron - Mispelling or phoneme pronunciation
           (type=string)
type - Type of the correction, tts_misspelled or tts_phonetic
           (type=integer)

Note: Class method


Instance Variable Details

dictionary

Dictionary of words and their correction/correction type pairings
Type:
dictionary

trans

Parser that replaces words with their corrections if found
Type:
Translator

Generated by Epydoc 2.1 on Fri Feb 18 13:59:27 2005 http://epydoc.sf.net