# Path: wordseg/utils.py
# def str2type(t):
# def type2str(t):
# def strip(string):
# def null_logger():
# def get_logger(name=None, level=logging.WARNING):
#     def __init__(self, elements):
#     def __iter__(self):
#     def __next__(self):
#     def __init__(self, function):
#     def __call__(self):
#     def exit(msg):
# def get_binary(binary):
# def get_config_files(algorithm, extension=None):
#     def __init__(self, short_name=None, name=None, type=None,
#                  default=None, help=''):
#     def add_to_parser(self, parser):
#     def parsed_name(self):
# def get_parser(description=None, separator=Separator(), train_file=False):
# def prepare_main(name=None,
#                  description=None,
#                  separator=Separator(phone=None, syllable=None, word=None),
#                  add_arguments=None,
#                  train_file=False):
# class CountingIterator:
# class CatchExceptions:
# class Argument:
# 
# Path: wordseg/folding.py
# def _permute(l):
# def _flatten(l):
# def _cumsum(l):
# def boundaries(text, nfolds):
# def fold(text, nfolds, fold_boundaries=None):
# def unfold(folds, index):


import codecs
import collections
import os
import joblib
from wordseg import utils, folding
        output_text = folding.unfold(segmented_texts, fold_index)

        return (utt for utt in output_text if utt)

    # force the train text from sequence to list
    train_text = list(train_text)
    log.info('train data: %s utterances loaded', len(train_text))

    # init a puddle model and train it
    model = Puddle(window=window, by_frequency=by_frequency, log=log)
    model.train(train_text)

    # segmentation of the test text, keeping the model constant
    return (utt for utt in model.segment(text, update_model=False) if utt)


def _add_arguments(parser):
    """Add algorithm specific options to the parser"""
    parser.add_argument(
        '-f', '--nfolds', type=int, metavar='<int>', default=None,
        help='number of folds to segment the text on, default is 5, '
        'ignored if <training-file> specified.')

    parser.add_argument(
        '-j', '--njobs', type=int, metavar='<int>', default=None,
        help='number of parallel jobs to use, default is 1, '
        'ignored if <training-file> specified.')

    parser.add_argument(
        '-w', '--window', type=int, default=2, metavar='<int>', help='''

# Path: wordseg/utils.py
# def str2type(t):
# def type2str(t):
# def strip(string):
# def null_logger():
# def get_logger(name=None, level=logging.WARNING):
#     def __init__(self, elements):
#     def __iter__(self):
#     def __next__(self):
#     def __init__(self, function):
#     def __call__(self):
#     def exit(msg):
# def get_binary(binary):
# def get_config_files(algorithm, extension=None):
#     def __init__(self, short_name=None, name=None, type=None,
#                  default=None, help=''):
#     def add_to_parser(self, parser):
#     def parsed_name(self):
# def get_parser(description=None, separator=Separator(), train_file=False):
# def prepare_main(name=None,
#                  description=None,
#                  separator=Separator(phone=None, syllable=None, word=None),
#                  add_arguments=None,
#                  train_file=False):
# class CountingIterator:
# class CatchExceptions:
# class Argument:
# 
# Path: wordseg/folding.py
# def _permute(l):
# def _flatten(l):
# def _cumsum(l):
# def boundaries(text, nfolds):
# def fold(text, nfolds, fold_boundaries=None):
# def unfold(folds, index):


# Path: wordseg/algos/puddle.py
import codecs
import collections
import os
import joblib
from wordseg import utils, folding

        output_text = folding.unfold(segmented_texts, fold_index)

        return (utt for utt in output_text if utt)

    # force the train text from sequence to list
    train_text = list(train_text)
    log.info('train data: %s utterances loaded', len(train_text))

    # init a puddle model and train it
    model = Puddle(window=window, by_frequency=by_frequency, log=log)
    model.train(train_text)

    # segmentation of the test text, keeping the model constant
    return (utt for utt in model.segment(text, update_model=False) if utt)


def _add_arguments(parser):
    """Add algorithm specific options to the parser"""
    parser.add_argument(
        '-f', '--nfolds', type=int, metavar='<int>', default=None,
        help='number of folds to segment the text on, default is 5, '
        'ignored if <training-file> specified.')

    parser.add_argument(
        '-j', '--njobs', type=int, metavar='<int>', default=None,
        help='number of parallel jobs to use, default is 1, '
        'ignored if <training-file> specified.')

    parser.add_argument(
        '-w', '--window', type=int, default=2, metavar='<int>', help='''

        Number of phonemes to be taken into account for boundary constraint,