# 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

    def get_witness(self, work, siglum, text_class=WitnessText):
        """Returns a `WitnessText` representing the file associated with
        `work` and `siglum`.

        Combined, `work` and `siglum` form the basis of a filename for
        retrieving the text.

        :param work: name of work
        :type work: `str`
        :param siglum: siglum of witness
        :type siglum: `str`
        :param text_class: class to use to represent the witness
        :type text_class: subclass of `Text`
        :rtype: `text_class`

        """
        filename = os.path.join(work, siglum + '.txt')
        self._logger.debug('Creating WitnessText object from {}'.format(
            filename))
        with open(os.path.join(self._path, filename), encoding='utf-8') \
                as fh:
            try:
                content = fh.read()
            except Exception:
                self._logger.error('Failed to read witness text {}'.format(
                    filename))
                raise
        return text_class(work, siglum, content, self._tokenizer)


# 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


    def get_witness(self, work, siglum, text_class=WitnessText):
        """Returns a `WitnessText` representing the file associated with
        `work` and `siglum`.

        Combined, `work` and `siglum` form the basis of a filename for
        retrieving the text.

        :param work: name of work
        :type work: `str`
        :param siglum: siglum of witness
        :type siglum: `str`
        :param text_class: class to use to represent the witness
        :type text_class: subclass of `Text`
        :rtype: `text_class`

        """
        filename = os.path.join(work, siglum + '.txt')
        self._logger.debug('Creating WitnessText object from {}'.format(
            filename))
        with open(os.path.join(self._path, filename), encoding='utf-8') \
                as fh:
            try:
                content = fh.read()
            except Exception:
                self._logger.error('Failed to read witness text {}'.format(
                    filename))
                raise
        return text_class(work, siglum, content, self._tokenizer)


    def get_witnesses(self, name='*', text_class=WitnessText):