Package org.apache.nlpcraft.model
Interface NCCustomParser
-
- All Superinterfaces:
NCLifecycle
public interface NCCustomParser extends NCLifecycle
Custom model element parser for programmatic NER implementations. This parser allows to define your own Named Entity Recognizer (NER) implementation in cases when the standard declarative methods are not expressive enough. Instance of the parser should be made available in the model viaNCModelView.getParsers()
method.By default, the data model detects its elements by their declarative synonyms. However, in some cases this is not expressive enough. In such cases, one or more user-defined parsers can be defined for the model that would allow the user to define its own NER logic to detect the model elements in the user input programmatically. Note that there can be multiple custom parsers per model and each one can detect any number of model elements.
- See Also:
NCModelView.getParsers()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<NCCustomElement>
parse(NCRequest req, NCModelView mdl, List<NCCustomWord> words, List<NCCustomElement> elements)
Analyses user input provided as a list ofNCCustomWord
objects and returns a list ofNCCustomElement
objects.-
Methods inherited from interface org.apache.nlpcraft.model.NCLifecycle
onDiscard, onInit
-
-
-
-
Method Detail
-
parse
List<NCCustomElement> parse(NCRequest req, NCModelView mdl, List<NCCustomWord> words, List<NCCustomElement> elements)
Analyses user input provided as a list ofNCCustomWord
objects and returns a list ofNCCustomElement
objects. Note that model elements returned from this method must be defined in the model, i.e. this method only provides an additional logic of detecting these elements but they still need to be defined normally in the model.- Parameters:
req
- User request descriptor.mdl
- Instance of data model this parser belongs to.words
- Entire user input represented as a list of custom words.elements
- List of already parsed and detected model elements at the point of this call.- Returns:
- List of custom elements. List can be empty or
null
if no model elements detected. - See Also:
NCModelView.getParsers()
-
-