Module speakable
[hide private]
[frames] | no frames]

Source Code for Module speakable

 1  """Interface Speakable --- Generic   Speakable objects. 
 2   
 3  Producing good quality spoken output requires knowledge of the 
 4  content. Such knowledge includes: 
 5   
 6      Custom parsing rules for determining clause boundaries. 
 7      Custom pronunciation rules.  
 8   
 9  In general, it is not practical for a generic Speaker object to 
10  be aware of every type of speakable content. Examples of 
11  Speakable content include: 
12   
13      Email messages. 
14      Web pages. 
15      Electronic books. 
16      Program source code in different languages. 
17   
18  Interface Speakable is defined as a light-weight interface that 
19  can be extended and customize by different content-types. The 
20  default implementation provides a generic parser and 
21  pronunciation dictionary. 
22   
23  Objects implementing Interface Speakable can be passed to method 
24  Speaker.render to produce well-formatted auditory output. 
25   
26  Methods defined by Interface Speakable: 
27   
28  Speakable objects implement a generic iterator/generator 
29  interface so that one can write code within method Speaker.render 
30  of the form: 
31   
32      for clause in SpeakableParagraph:s.say(clause) 
33   
34  This allows object Speaker to chunk content in a manner 
35  appropriate to the content-type being spoken. 
36   
37  Within the implementation of the iterator, one can customize how 
38  a particular 'clause' is rendered by applying custom 
39  pronunciation rules. 
40   
41  """ 
42   
43   
44  __id__ = "$Id: speakable.py 3535 2005-11-17 14:32:59Z raman $" 
45  __author__ = "$Author: raman $" 
46  __version__ = "$Revision: 3535 $" 
47  __date__ = "$Date: 2005-11-17 06:32:59 -0800 (Thu, 17 Nov 2005) $" 
48  __copyright__ = "Copyright (c) 2005 T. V. Raman" 
49  __license__ = "LGPL" 
50   
51 -class Speakable:
52 53 """Default implementation of Interface Speakable. """ 54 55
56 - def __init__(self, content=""):
57 """Initialize Speakable with content. 58 59 Content is held by reference.""" 60 self.content = content
61