Obscura.Recognizer.NER.FakeServing (obscura v0.1.0)

Copy Markdown View Source

Deterministic fake NER serving used by fixtures and tests.

The struct intentionally has a small Inspect representation so configured source texts or model outputs are not printed accidentally.

Summary

Functions

Creates a fake serving from either a text-to-outputs map or a single output list.

Returns fake model outputs for one text.

Returns fake model outputs for many texts.

Types

t()

@type t() :: %Obscura.Recognizer.NER.FakeServing{outputs: map() | list()}

Functions

new(outputs)

@spec new(map() | list()) :: t()

Creates a fake serving from either a text-to-outputs map or a single output list.

predict(fake_serving, text, opts \\ [])

@spec predict(t(), String.t(), keyword()) :: {:ok, [map()]} | {:error, term()}

Returns fake model outputs for one text.

predict_many(serving, texts, opts \\ [])

@spec predict_many(t(), [String.t()], keyword()) ::
  {:ok, [[map()]]} | {:error, term()}

Returns fake model outputs for many texts.