def detect_field_values(cls, log: ProcessLogger, doc: Document,
                         field: DocumentField) -> List[DetectedFieldValue]:
     try:
         return super().detect_field_values(log, doc, field)
     except ClassifierModel.DoesNotExist:
         return RegexpsOnlyFieldDetectionStrategy.detect_field_values(
             log, doc, field)
    RegexpsAndTextBasedMLFieldDetectionStrategy, TextBasedMLFieldDetectionStrategy
from apps.document.fields_detection.regexps_field_detection import RegexpsOnlyFieldDetectionStrategy, \
    FieldBasedRegexpsDetectionStrategy
from apps.document.fields_processing import field_value_cache
from apps.document.fields_processing.field_processing_utils import merge_detected_field_values_to_python_value, \
    order_field_detection
from apps.document.models import ClassifierModel
from apps.document.models import Document, DocumentType, DocumentField

STRATEGY_DISABLED = DisabledFieldDetectionStrategy()

_FIELD_DETECTION_STRATEGIES = [
    FieldBasedMLOnlyFieldDetectionStrategy(),
    FormulaAndFieldBasedMLFieldDetectionStrategy(),
    FormulaBasedFieldDetectionStrategy(),
    RegexpsOnlyFieldDetectionStrategy(),
    RegexpsAndTextBasedMLFieldDetectionStrategy(),
    TextBasedMLFieldDetectionStrategy(),
    PythonCodedFieldDetectionStrategy(),
    FieldBasedRegexpsDetectionStrategy(), STRATEGY_DISABLED
]

FIELD_DETECTION_STRATEGY_REGISTRY = {
    st.code: st
    for st in _FIELD_DETECTION_STRATEGIES
}


def train_document_field_detector_model(
    log: ProcessLogger,
    document_type: DocumentType,