HtmlFilter

javadoc

Htmlfilter is a service that can be used to either strip out text or wrap the input text in html tags. For example it can be used to filter away html code from ProgramAB before sending the text to a speech synthesis service.

Example for develop:

#file : HtmlFilter.py edit raw

# 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)