Obscura.NLP.Engine behaviour (obscura v0.1.0)

Copy Markdown View Source

Behaviour and dispatcher for analyzer-level NLP artifact engines.

Presidio runs NLP once and passes shared artifacts to recognizers. Obscura's default engine remains dependency-light tokenization, while optional engines can attach model outputs for recognizers such as Obscura.Recognizer.NER.

Summary

Functions

Builds artifacts for one text using explicit artifacts, a configured engine, or the dependency-light tokenizer.

Builds artifacts for many texts while preserving input order.

Callbacks

build_artifacts(t, keyword)

@callback build_artifacts(
  String.t(),
  keyword()
) :: {:ok, Obscura.NLP.Artifacts.t()} | {:error, term()}

build_many(list, keyword)

(optional)
@callback build_many(
  [String.t()],
  keyword()
) :: {:ok, [Obscura.NLP.Artifacts.t()]} | {:error, term()}

Functions

build_artifacts(text, opts)

@spec build_artifacts(
  String.t(),
  keyword()
) :: {:ok, Obscura.NLP.Artifacts.t()} | {:error, term()}

Builds artifacts for one text using explicit artifacts, a configured engine, or the dependency-light tokenizer.

build_many(texts, opts)

@spec build_many(
  [String.t()],
  keyword()
) :: {:ok, [Obscura.NLP.Artifacts.t()]} | {:error, term()}

Builds artifacts for many texts while preserving input order.