Namespaces for custom regular expressions (optional)
Custom Predictors and Data Labeling
Within the config, you may optionally specify a label_predictors object where you can define custom predictors that will create custom entity labels.
This example creates a custom regular expression for a custom user id format:
# ... classify model defined here ...
- score: high
If you wish to create custom predictors, you must provide a namespace which will be used when constructing the labels used.
regex: Create your own regular expressions to match and yield custom labels. The value for this property should be an object that is keyed by thelabels you wish to create. For each label you wish to create, you should provide an array of patterns. Patterns are objects consisting of:
score: One of high, med, low. These map to floating point values of .8, ,5 and .2 respectively. If omitted the default is high.
regex: The actual regex that will be used to match. When crafting your regex and testing it, ensure that it is compatible with Python 3.
In the example above, the namespace and the keys of the regex object are combined to create your custom labels. For above, the label acme/user_id will be created when a match occurs.
You can now combine the label_predictors with your classify policy. For example: