public interface NCCustomParser extends NCLifecycle
NCModelView.getParsers()
method.
By default the semantic 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.
NCModelView.getParsers()
Modifier and Type | Method and Description |
---|---|
List<NCCustomElement> |
parse(NCRequest req,
NCModelView mdl,
List<NCCustomWord> words,
List<NCCustomElement> elements)
Analyses user input provided as a list of
NCCustomWord objects and returns a list
of NCCustomElement objects. |
onDiscard, onInit
List<NCCustomElement> parse(NCRequest req, NCModelView mdl, List<NCCustomWord> words, List<NCCustomElement> elements)
NCCustomWord
objects and returns a list
of NCCustomElement
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.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.null
if no model elements detected.NCModelView.getParsers()
Copyright © 2020 NLPCraft. All rights reserved.