# 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 joblib
import logging
import os
import re
import shlex
import six
import subprocess
import tempfile
import threading
from wordseg import utils, folding
   original Gibbs sampler (*flip sampler*) as well as a sentence-based
   Gibbs sampler that uses dynamic programming (*tree sampler*) and a
   similar dynamic programming algorithm that chooses the best
   segmentation of each utterance rather than a sample. The latter
   two algorithms can be run either in batch mode or in online mode.
   If in online mode, they can also be set to "forget" parts of the
   previously analysis. This is described in more detail below.

3. Functionality for using separate training and testing files.  If
   you provide an evaluation file, the program will first run through
   its full training procedure (i.e., using whichever algorithm for
   however many iterations, kneeling, etc.). After that, it will
   freeze the lexicon in whatever state it is in and then make a
   single pass through the evaluation data, segmenting each sentence
   according to the probabilities computed from the frozen lexicon.
   No new words/counts will be added to the lexicon during evaluation.
   Evaluation can be set to either sample segmentations or choose the
   maximum probability segmentation for each utterance. Scores will
   be printed out at the end of the complete run based on either the
   evaluation data (if provided) or the training data (if not).

"""




# # a list of dpseg options we don't want to expose in wordseg-dpseg
# ['--help', '--data-file', '--data-start-index', '--data-num-sents',
#  '--eval-start-index', '--eval-num-sents', '--output-file']
DPSEG_ARGUMENTS = [

# 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/dpseg.py
import joblib
import logging
import os
import re
import shlex
import six
import subprocess
import tempfile
import threading
from wordseg import utils, folding

   original Gibbs sampler (*flip sampler*) as well as a sentence-based
   Gibbs sampler that uses dynamic programming (*tree sampler*) and a
   similar dynamic programming algorithm that chooses the best
   segmentation of each utterance rather than a sample. The latter
   two algorithms can be run either in batch mode or in online mode.
   If in online mode, they can also be set to "forget" parts of the
   previously analysis. This is described in more detail below.

3. Functionality for using separate training and testing files.  If
   you provide an evaluation file, the program will first run through
   its full training procedure (i.e., using whichever algorithm for
   however many iterations, kneeling, etc.). After that, it will
   freeze the lexicon in whatever state it is in and then make a
   single pass through the evaluation data, segmenting each sentence
   according to the probabilities computed from the frozen lexicon.
   No new words/counts will be added to the lexicon during evaluation.
   Evaluation can be set to either sample segmentations or choose the
   maximum probability segmentation for each utterance. Scores will
   be printed out at the end of the complete run based on either the
   evaluation data (if provided) or the training data (if not).

"""




# # a list of dpseg options we don't want to expose in wordseg-dpseg
# ['--help', '--data-file', '--data-start-index', '--data-num-sents',
#  '--eval-start-index', '--eval-num-sents', '--output-file']
DPSEG_ARGUMENTS = [

    utils.Argument(