__init__.py 741 字节
Newer Older
W
weishengyu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
from abc import ABC, abstractmethod

from algo_mod import build_algo_mod
from searcher import build_searcher
from data_processor import build_data_processor


def build_processor(config):
    processor_type = config.get("processor_type")
    if processor_type == "algo_mod":
        return build_algo_mod(config)
    elif processor_type == "searcher":
        return build_searcher(config)
    elif processor_type == "data_processor":
        return build_data_processor(config)
    else:
        raise NotImplemented("processor_type {} not implemented.".format(processor_type))


class BaseProcessor(ABC):
    @abstractmethod
    def __init__(self, config):
        pass

    @abstractmethod
    def process(self, input_data):
        pass