#encoding = utf8
import logging

from asr import AsrObserver
from utils import AsyncTaskQueue

logger = logging.getLogger(__name__)


class NLPBase(AsrObserver):
    def __init__(self, split):
        self._ask_queue = AsyncTaskQueue()
        self._ask_queue.start_worker()
        self._split_handle = split

    async def _request(self, question):
        pass

    def process(self, message: str):
        pass

    def completed(self, message: str):
        print('complete :', message)
        self.ask(message)

    def ask(self, question):
        self._ask_queue.add_task(self._request(question))

    def stop(self):
        self._ask_queue.stop()
    