from abc import ABCMeta, abstractmethod 
from saper.utils.wcrftproc import Tagger

class Reader():
    """
    Reader interface.
    """
    __metaclass__ = ABCMeta

    def __init__(self):
        """
        The Reader class is an interface. However you should call __init__
        in order to get access to the tagger. 
        """
        self._tagger = None

    @abstractmethod
    def read_file(self, file_path):
        """
        This method should read selected file and return a corpus2.Document
        object.
        """
        raise NotImplementedError("You should implement this method")

    @abstractmethod
    def read_folder(self, file_path, extension):
        """
        This method should reads selected folder and returns list of
        corpus2.Document.
        """
        raise NotImplementedError("You should implement this method")

    @property
    def tagger(self):
        if not self._tagger:
            self._tagger = Tagger()
        return self._tagger

    @tagger.setter
    def tagger(self, tagger_object):
        self._tagger = tagger_object

    @tagger.deleter
    def tagger(self):
        self._tagger = None
