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

Type Translator

object --+    
         |    
      dict --+
             |
            Translator


Replaces words with phonetic representations or misspellings in order to correct for pronunciation. This class is based on the Xlator class by Xavier Defrang.
Method Summary
  __init__(self, d)
Initializes an instance.
  __call__(self, match)
Builds a pronunciation correction for the provided match object.
  makeRegex(self)
Compiles the regular expression.
  Translate(self, text)
Replace words in a text segment with pronunciation corrections.
Inherited from dict: __cmp__, __contains__, __delitem__, __eq__, __ge__, __getattribute__, __getitem__, __gt__, __hash__, __iter__, __le__, __len__, __lt__, __ne__, __new__, __repr__, __setitem__, clear, copy, get, has_key, items, iteritems, iterkeys, itervalues, keys, pop, popitem, setdefault, update, values
Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__, __str__
Inherited from type: fromkeys

Instance Variable Summary
re object regex: Regular expression used to replace words

Method Details

__init__(self, d)
(Constructor)

Initializes an instance.
Parameters:
d -
           (type=dictionary)
Overrides:
__builtin__.dict.__init__

__call__(self, match)
(Call operator)

Builds a pronunciation correction for the provided match object.
Parameters:
match - Word identified to have its pronunciation fixed
           (type=re.MatchObject)

makeRegex(self)

Compiles the regular expression.

Translate(self, text)

Replace words in a text segment with pronunciation corrections.
Parameters:
text - Segment of text with words needing correction
           (type=string)

Instance Variable Details

regex

Regular expression used to replace words
Type:
re object

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