-
Notifications
You must be signed in to change notification settings - Fork 135
Post_Processors
Post processors converts the raw answer after it has been returned from the brain.
Post processors are chained together, and are called in the sequence order in which they are defined in their
configuration file postprocessors.conf
. Each post processor is listed as the full Python class path.
As an example the current Y-Bot post processor configuration looks like this. A line starting with a #
shows that
post processor is commented out
programy.processors.post.denormalize.DenormalizePostProcessor
programy.processors.post.formatpunctuation.FormatPunctuationProcessor
programy.processors.post.formatnumbers.FormatNumbersPostProcessor
programy.processors.post.multispaces.RemoveMultiSpacePostProcessor
programy.processors.post.removehtml.RemoveHTMLPostProcessor
programy.processors.post.consoleformat.ConsoleFormatPostProcessor
#programy.processors.post.translate.TranslatorPostProcessor
#programy.processors.post.emojize.EmojizePostProcessor
The available post processors are currently
- DenormalizePostProcessor. Denormalises the output into more human readable english.
- FormatPunctuationProcessor. Formats punctuation by removing/adding spaces etc.
- FormatNumbersPostProcessor. Formats numbers by converting to numeric values and removing spaces.
- RemoveMultiSpacePostProcessor. Removes multipl spaces added by the parser.
- RemoveHTMLPostProcessor. Removes HTML.
- ConsoleFormatPostProcessor. Formats the output for 80 character width consoles
- TranslatorPostProcessor. Translates the text using Google Translate.
- EmojizePostProcessor. Replaces emoji character strings with the pictorial equivalent.
Post Processors inherit from the abstract base class
programy.processors.processing.PostProcessor
The class has a single method, process, which takes bot, client and the string to post-process and should return the processed string
class PostProcessor(Processor):
def __init__(self):
Processor.__init__(self)
@abstractmethod
def process(self, bot, clientid, string):
pass
Once built and tested the path to the class needs to be appened to PYTHONPATH system variable
Email: [email protected] | Twitter: @keiffster | Facebook: keith.sterling | LinkedIn: keithsterling | My Blog
- Home
- Background
- Guiding Principles
- Reporting an Issue
- Installation
- You And Your Bot
- Bots
- Clients
- Configuration
- AIML
- Sentence Splitting
- Natural Langauge Processing
- Normalization
- Spelling
- Sentiment Analysis
- Translation
- Security
- Hot Reload
- Logging
- Out of Band
- Multi Language
- RDF Support
- Rich Media
- Asynchronous Events
- Triggers
- External Services
- Dynamic Sets, Maps & Vars
- Extensions
- Pre & Post Processors
- Custom Nodes
- The Brain Tree
- Utilities
- Building It Yourself
- Creating Your Own Bot
- Contributing
- Performance Testing
- FAQ
- History
- Website