Ejemplo n.º 1
0
def initialize_with(heap_size, load_init_files):
    tts.initialize(heap_size, load_init_files)
Ejemplo n.º 2
0
def initialize():
    tts.initialize()
Ejemplo n.º 3
0
def initialize():
	tts.initialize()
Ejemplo n.º 4
0
def initialize_with(heap_size, load_init_files):
	tts.initialize(heap_size, load_init_files)
Ejemplo n.º 5
0
to the tts module to be converted to speech.

As the URL and the regular expression are both hard-coded, this application
is very sensitive to changes in the location and layout of the target web
page.
"""

import urllib, re
import nltk_contrib.misc.festival.tts as tts

URL	= "http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDV10450.txt"
REGEXP	= "(Forecast for Melbourne .*)Suburban"

try:
	page = urllib.urlopen(URL).read()
except IOError, e:
	print "Unable to connect to web server."
	sys.exit(1)

x = re.search(REGEXP, page, re.DOTALL)  # DOTALL ensures newlines are included

if x:
	text = x.group(1)
	print text

	tts.initialize()
	tts.say_text(text)

else:
	print "Web page does not have the expected format."