# 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
                            return self._process_utterance(
                                utterance[j+1:],
                                segmented=segmented,
                                do_update=do_update)

                        # go to the next chunk and apply the same condition
                        self._log.info(
                            'go to next chunk : %s', utterance[j+1:])
                        break

                j += 1
            i += 1  # or go to the next phoneme

        if not found:
            process_candidate(segmented, utterance, 0, len(utterance) - 1)

        return segmented


def _do_puddle(text, window, by_frequency, log_level, log_name):
    """Auxiliary function to segment"""
    model = Puddle(
        window=window,
        by_frequency=by_frequency,
        log=utils.get_logger(name=log_name, level=log_level))

    return list(model.segment(text, update_model=True))


def segment(text, train_text=None, window=2, by_frequency=False, nfolds=5,

# 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

                            return self._process_utterance(
                                utterance[j+1:],
                                segmented=segmented,
                                do_update=do_update)

                        # go to the next chunk and apply the same condition
                        self._log.info(
                            'go to next chunk : %s', utterance[j+1:])
                        break

                j += 1
            i += 1  # or go to the next phoneme

        if not found:
            process_candidate(segmented, utterance, 0, len(utterance) - 1)

        return segmented


def _do_puddle(text, window, by_frequency, log_level, log_name):
    """Auxiliary function to segment"""
    model = Puddle(
        window=window,
        by_frequency=by_frequency,
        log=utils.get_logger(name=log_name, level=log_level))

    return list(model.segment(text, update_model=True))


def segment(text, train_text=None, window=2, by_frequency=False, nfolds=5,

            njobs=1, log=utils.null_logger()):