def generate_sentences(text='', train_path=None, case_sensitive=True, ext=['.md', '.txt', '.asc', '.asciidoc'],
                       normalize_ordinals=1, normalize_newlines=1, normalize_sentence_boundaries=1,
                       epochs=20, classifier=nlup.BinaryAveragedPerceptron,
                       re_eol=r'\r\n|\r|\n', **kwargs):
    """Generate sentences from a sequence of characters (text)

    Wrapped text (newlines at column 80, for instance) will break this, breaking up sentences.
    Wrapper and preprocessor for Kyle Gorman's "DetectorMorse" module

    Arguments:
      preprocess (bool): whether to assume common sentence delimitters in markdown and asciidoc formatting
                         using r'[.?!][ \t]*\n\n|[.?!][ \t]*\r\n\r\n|[.?!][ \t]*\r\r|[.?!][ ][ ][A-Z]'
      case_sensitive (int): whether to consider case to make decisions about sentence boundaries
      epochs (int): number of epochs (iterations for classifier training)

    """
    ext = [ext] if isinstance(ext, basestring) else ext
    if isinstance(text, basestring) and len(text) <= 256:
        if os.path.isfile(text) and os.path.splitext(text)[-1].lower() in ext:
            text = open(text)
        elif os.path.isdir(text):
            return chain.from_iterable((
                generate_sentences(text=stat['path'], train_path=train_path, ext=ext,
                                   normalize_ordinals=normalize_ordinals, normalize_newlines=normalize_ordinals,
                                   normalize_sentence_boundaries=normalize_sentence_boundaries,
                                   epochs=epochs, classifier=classifier, re_eol=re_eol, **kwargs)
                for stat in find_files(text, ext=ext)))
    if isinstance(text, basestring):
        texts = Split(text=text, re_delim=re_eol)
    else:
        texts = chain.from_iterable(Split(text=doc, re_delm=re_eol) for doc in text)

    if normalize_newlines:
        re_eol = re.compile(r'\r\n|\r')
        texts = (re_eol.sub(r'\n', doc) for doc in texts)
    if normalize_ordinals:
        re_ord = re.compile(r'\b([0-9]+|[A-Za-z])[.?!][ \t]{1,4}([A-Za-z])')
        texts = (re_ord.sub(r'\1) \2', doc) for doc in texts)
    if normalize_sentence_boundaries:
        re_eos = re.compile(r'([.?!])([ ][ ])[\n]?([A-Z])')
        texts = (re_eos.sub(r'\1\n\3', doc) for doc in texts)

    if train_path:
        generate_sentences.detector = Detector(slurp(train_path), epochs=epochs, nocase=not case_sensitive)
    elif not isinstance(getattr(generate_sentences, 'detector', None), Detector):
        generate_sentences.detector = Detector.load(
            os.path.join(DATA_PATH, 'wsj_pugnlp.detector_morse.Detector.json.gz'))
    # generate_sentences.detector = SentenceDetector(text=text, nocase=not case_sensitive,
    # epochs=epochs, classifier=classifier)
    return iter(chain.from_iterable((s.lstrip() for s in generate_sentences.detector.segments(text)) for text in texts))