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 code (from branch develop):
#file : HtmlFilter.py (github)
# 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.start("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)
Example configuration (from branch develop):
#file : HtmlFilter.py (github)
!!org.myrobotlab.service.config.HtmlFilterConfig listeners: null peers: null postHtmlTag: </pre> preHtmlTag: <pre> stripHtml: true stripUrls: true type: HtmlFilter