-
Notifications
You must be signed in to change notification settings - Fork 136
/
Copy pathHtmlFilter.py
26 lines (19 loc) · 943 Bytes
/
HtmlFilter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Some Services do not like anything other than pure text
# while other Services will produce text with markup tags included
# To join (route) the output of a Service with markup tags to one that
# doesn't support the markup tags, we need to filter it.
# Enter the HtmlFilter service
# The most common use for this service is from a chatbot service like
# ProgramAB to a TTS Service like MarySpeech Service.
# Start the service
htmlfilter = Runtime.start("htmlfilter","HtmlFilter")
# Start one of the Text To Speach Service
mouth = Runtime.start("mouth", "MarySpeech")
# Start a chatbox service to generate an output
alice2 = Runtime.createAndStart("alice2", "ProgramAB")
# Load a session into the chatbox
alice2.startSession("user", "alice2")
# Add routing from the the chatbox service to the HtmlFilter service
alice2.addTextListener(htmlfilter)
# Add routing to the TTS service from the htmlfilter
htmlfilter.addTextListener(mouth)