Package com.artisol.teneo.engine.core.inputprocessor

This package defines the concept of an input processor chain that maintains an ordered sequence of one or more input processors.

A user input text is processed by an input processor chain in order to convert it into one or more sentences (each containing a number of words), and to optionally generate additional annotations.

The input processor chain passes the user input text, the sentences, and the annotations data from one input processor to the next in the chain, so that each processor can utilize the data generated by the previous processor and extend or modify it.

The InputProcessorChain also provides a so called "simplifier" that provides functionality to bring a given text into some normalized form. The simplifier is customizable through a plug-in mechanism (see method InputProcessorChain.setSimplifier(com.artisol.teneo.engine.core.inputprocessor.SimplifierI)).

Usage pattern:

 class InputProcessorA extends InputProcessor {
     // add implementations of abstract methods
 }
 class InputProcessorB extends InputProcessor {
     // add implementations of abstract methods
 }

 DictionaryI dictionary = new SimpleDictionary();  // optional, depends on processor imlementations
 SimplifierI simplifier = new SimplifierImpl();
 InputProcessorChain ipc = new InputProcessorChain();
 simplifier.initialize(properties, locale);
 ipc.setSimplifier(simplifier);
 ipc.setProcessors(Arrays.<InputProcessor>asList(new InputProcessorA(), new InputProcessorB()));
 Properties initProperties = new Properties();
 initProperties.setProperty(InputProcessorChain.PROPERTY_LOCALE_LANGUAGE, localeId); // mandatory property!
 ipc.initializeProcessors(initProperties, dictionary);

 for (String userInput : userInputs) {
     List<SentenceI> sentences = new ArrayList<SentenceI>();
     AnnotationsI annotations = new Annotations();
     ipc.process(userInput, Collections.EMPTY_MAP, new Properties(), sentences, annotations);
     // add actions here that utilize the sentences and annotations
 }

 ipc.shutdown();
 
See Also:
InputProcessorChain, InputProcessor, SentenceI, WordDataI
Version:
7.6.0-SP1