# Path: tacl/text.py
# class WitnessText (Text):
# 
#     """Class for the text of a witness. A witness has a work name and a
#     siglum, and has a corresponding filename."""
# 
#     def __init__(self, work, siglum, content, tokenizer):
#         super().__init__(content, tokenizer)
#         self._work = work
#         self._siglum = siglum
#         self._filename = self.assemble_filename(work, siglum)
# 
#     @staticmethod
#     def assemble_filename(work, siglum):
#         return os.path.join(work, siglum + '.txt')
# 
#     def get_checksum(self):
#         """Returns the checksum for the content of this text.
# 
#         :rtype: `str`
# 
#         """
#         return hashlib.md5(self._content.encode('utf-8')).hexdigest()
# 
#     def get_filename(self):
#         """Returns the filename of this text.
# 
#         :rtype: `str`
# 
#         """
#         return self._filename
# 
#     @property
#     def siglum(self):
#         return self._siglum
# 
#     @property
#     def work(self):
#         return self._work


import glob
import logging
import os
from .text import WitnessText
    A Corpus is built from a directory that contains the text files
    that become `WitnessText` objects.

    """

    def __init__(self, path, tokenizer):
        self._logger = logging.getLogger(__name__)
        self._path = os.path.abspath(path)
        self._tokenizer = tokenizer

    @property
    def path(self):
        """Returns the absolute path to this corpus.

        :rtype: `str`

        """
        return self._path

    def get_sigla(self, work):
        """Returns a list of all of the sigla for `work`.

        :param work: name of work
        :type work: `str`
        :rtype: `list` of `str`

        """
        return [os.path.splitext(os.path.basename(path))[0]
                for path in glob.glob(os.path.join(self._path, work, '*.txt'))]


# Path: tacl/text.py
# class WitnessText (Text):
# 
#     """Class for the text of a witness. A witness has a work name and a
#     siglum, and has a corresponding filename."""
# 
#     def __init__(self, work, siglum, content, tokenizer):
#         super().__init__(content, tokenizer)
#         self._work = work
#         self._siglum = siglum
#         self._filename = self.assemble_filename(work, siglum)
# 
#     @staticmethod
#     def assemble_filename(work, siglum):
#         return os.path.join(work, siglum + '.txt')
# 
#     def get_checksum(self):
#         """Returns the checksum for the content of this text.
# 
#         :rtype: `str`
# 
#         """
#         return hashlib.md5(self._content.encode('utf-8')).hexdigest()
# 
#     def get_filename(self):
#         """Returns the filename of this text.
# 
#         :rtype: `str`
# 
#         """
#         return self._filename
# 
#     @property
#     def siglum(self):
#         return self._siglum
# 
#     @property
#     def work(self):
#         return self._work


# Path: tacl/corpus.py
import glob
import logging
import os
from .text import WitnessText

    A Corpus is built from a directory that contains the text files
    that become `WitnessText` objects.

    """

    def __init__(self, path, tokenizer):
        self._logger = logging.getLogger(__name__)
        self._path = os.path.abspath(path)
        self._tokenizer = tokenizer

    @property
    def path(self):
        """Returns the absolute path to this corpus.

        :rtype: `str`

        """
        return self._path

    def get_sigla(self, work):
        """Returns a list of all of the sigla for `work`.

        :param work: name of work
        :type work: `str`
        :rtype: `list` of `str`

        """
        return [os.path.splitext(os.path.basename(path))[0]
                for path in glob.glob(os.path.join(self._path, work, '*.txt'))]


    def get_witness(self, work, siglum, text_class=WitnessText):