Skip to content

Base

Abstract detection engine definitions and shared helpers.

Authors

Dimitrij Ray (dimitrij.ray@gdplabs.id)

References

NONE

DetectionEngine

Bases: ABC

Base detection engine interface.

batch_detect(texts)

Produce detection data for each text in an iterable.

Parameters:

Name Type Description Default
texts Iterable[str]

Ordered iterable of input texts to classify.

required

Returns:

Type Description
list[EngineDetectionOutput]

list[EngineDetectionOutput]: Detection outputs matching the order of texts.

detect(text) abstractmethod

Produce detection data for a single text.

This method must be implemented by subclasses to provide detection data for a single text.

Parameters:

Name Type Description Default
text str

Input text to classify.

required

Returns:

Name Type Description
EngineDetectionOutput EngineDetectionOutput

Detection output containing primary and alternative candidates.