# Path: abkhazia/corpus/prepare/abstract_preparator.py
# class AbstractPreparatorWithCMU(AbstractPreparator):
#     """Specialized wrapper for preparators relying on the CMU dictionary
# 
#     Abkhazia automatically downloaded the dictionary for you during
#     installation. It is available for free at
#     http://www.speech.cs.cmu.edu/cgi-bin/cmudict. The preparator is
#     designed for version 0.7a of the CMU dictionary, but other recent
#     versions could probably be used without changing anything.
# 
#     """
#     default_cmu_dict = pkg_resources.resource_filename(
#         pkg_resources.Requirement.parse('abkhazia'),
#         'abkhazia/share/cmudict.0.7a')
# 
#     def __init__(self, input_dir, cmu_dict=None,
#                  log=utils.logger.null_logger()):
#         super(AbstractPreparatorWithCMU, self).__init__(input_dir, log)
# 
#         # init path to CMU dictionary
#         if cmu_dict is None:
#             cmu_dict = self.default_cmu_dict
#         if not os.path.isfile(cmu_dict):
#             raise IOError(
#                 'CMU dictionary does not exist: {}'
#                 .format(cmu_dict))
# 
#         self.cmu_dict = cmu_dict
#         self.log.debug('CMU dictionary is %s', self.cmu_dict)


import os
import re
import abkhazia.utils as utils
from abkhazia.corpus.prepare import AbstractPreparatorWithCMU
# coding: utf-8
# Copyright 2016 Thomas Schatz, Xuan-Nga Cao, Mathieu Bernard
#
# This file is part of abkhazia: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Abkhazia is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with abkhazia. If not, see <http://www.gnu.org/licenses/>.

"""Data preparation for the LibriSpeech corpus

The raw distribution of LibriSpeech is available at
http://www.openslr.org/12/

The LibriSpeech dictionary is available for download at
http://www.openslr.org/resources/11/librispeech-lexicon.txt

"""





# Path: abkhazia/corpus/prepare/abstract_preparator.py
# class AbstractPreparatorWithCMU(AbstractPreparator):
#     """Specialized wrapper for preparators relying on the CMU dictionary
# 
#     Abkhazia automatically downloaded the dictionary for you during
#     installation. It is available for free at
#     http://www.speech.cs.cmu.edu/cgi-bin/cmudict. The preparator is
#     designed for version 0.7a of the CMU dictionary, but other recent
#     versions could probably be used without changing anything.
# 
#     """
#     default_cmu_dict = pkg_resources.resource_filename(
#         pkg_resources.Requirement.parse('abkhazia'),
#         'abkhazia/share/cmudict.0.7a')
# 
#     def __init__(self, input_dir, cmu_dict=None,
#                  log=utils.logger.null_logger()):
#         super(AbstractPreparatorWithCMU, self).__init__(input_dir, log)
# 
#         # init path to CMU dictionary
#         if cmu_dict is None:
#             cmu_dict = self.default_cmu_dict
#         if not os.path.isfile(cmu_dict):
#             raise IOError(
#                 'CMU dictionary does not exist: {}'
#                 .format(cmu_dict))
# 
#         self.cmu_dict = cmu_dict
#         self.log.debug('CMU dictionary is %s', self.cmu_dict)


# Path: abkhazia/corpus/prepare/librispeech_preparator.py
import os
import re
import abkhazia.utils as utils
from abkhazia.corpus.prepare import AbstractPreparatorWithCMU

# coding: utf-8
# Copyright 2016 Thomas Schatz, Xuan-Nga Cao, Mathieu Bernard
#
# This file is part of abkhazia: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Abkhazia is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with abkhazia. If not, see <http://www.gnu.org/licenses/>.

"""Data preparation for the LibriSpeech corpus

The raw distribution of LibriSpeech is available at
http://www.openslr.org/12/

The LibriSpeech dictionary is available for download at
http://www.openslr.org/resources/11/librispeech-lexicon.txt

"""





class LibriSpeechPreparator(AbstractPreparatorWithCMU):