Skip to content

winkNLP entities classifier

classify:winknlp-entities runs deterministic pattern-based named-entity recognition on configured prose fields via winkNLP custom entities.

One winkNLP model is loaded in the node's constructor; all configured patterns are registered via learnCustomEntities once at that time. The per-record hot path is nlp.readDoc(text).customEntities().out(its.detail) over each configured field.

Config slot

Under classification.winknlpEntities:

json
{
  "classification": {
    "winknlpEntities": {
      "fields": ["description", "summary"],
      "patterns": [
        {
          "name":      "two-action-cost",
          "patterns":  ["two actions", "two-action"],
          "className": "ActionTwoCost",
          "priority":  28
        }
      ]
    }
  }
}
FieldTypeRequiredDefaultNotes
patternsarray, min 1yesOne or more pattern groups.
patterns[].namestringyesUnique pattern identifier passed to winkNLP.
patterns[].patternsstring[], min 1yeswinkNLP pattern strings (literal tokens or alternations like [two|2]).
patterns[].classNamestringyesOntology class id proposed when this pattern fires.
patterns[].priorityinteger ≥ 0no28Numeric priority.
fieldsstring[]no["description"]Prose field names to inspect on each record.

Match semantics

Patterns are registered with matchValue: false, usePOS: false, useEntity: false, so pattern strings match against normalized (lowercase) token values as plain literals. Fields absent on a record, non-string, or empty are silently skipped.

Emitted proposal

The highest-priority matching pattern wins state.proposals['classify:winknlp-entities']. Every match across every field appears in reasons:

json
{
  "source":     "classify:winknlp-entities",
  "className":  "ActionTwoCost",
  "priority":   28,
  "confidence": 1,
  "reasons": [
    "winknlp:pattern=two-action-cost",
    "winknlp:matched=two actions",
    "winknlp:field=description"
  ]
}

Matched text snippets are truncated to 80 characters in reasons.

Edge cases

  • Malformed pattern. learnCustomEntities throws at construction; the error names every pattern in the failing group.
  • Unknown pattern type returned. Should never happen (we register every pattern ourselves); silently dropped if it does.
  • All fields absent. Returns no-match; other classifiers may still produce one.

See also

Released under the MIT License.