Runtime for Spectre's lightweight local vector classifier.
The classifier loads artifacts produced by Spectre.Classifier.Trainer and
exposes a route-like result for router plugs. It can run as a GenServer for
warm artifacts or load artifacts on demand with classify_once/2.
{:ok, _pid} = Spectre.Classifier.start_link(artifact_dir: "artifacts/spectre")
{:ok, route} = Spectre.Classifier.classify("create a project")
Summary
Functions
Returns a specification to start this module under a supervisor.
Classifies text using a running classifier process when available.
Classifies text by loading artifacts for this call.
Starts a classifier process that keeps the artifact loaded.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec classify( String.t(), keyword() ) :: {:ok, Spectre.Route.t()} | {:error, term()}
Classifies text using a running classifier process when available.
{:ok, route} = Spectre.Classifier.classify("show my projects")
@spec classify_once( String.t(), keyword() ) :: {:ok, Spectre.Route.t()} | {:error, term()}
Classifies text by loading artifacts for this call.
{:ok, route} = Spectre.Classifier.classify_once("show my projects", artifact_dir: path)
@spec start_link(keyword()) :: GenServer.on_start()
Starts a classifier process that keeps the artifact loaded.
Startup options are retained for warm classifications. Options supplied to
classify/2 override them for that call.
{:ok, pid} = Spectre.Classifier.start_link(artifact_dir: "artifacts/spectre")