def nltk_tokenzier_factory(nltk_tokenizer):
    '''
    Parameters
    ----------
    nltk_tokenizer : nltk.tokenize.* instance (e.g., nltk.TreebankWordTokenizer())

    Returns
    -------
    Doc of tweets

    Notes
    -------
    Requires NLTK to be installed
    '''

    def tokenize(text):
        toks = []
        for tok in nltk_tokenizer.tokenize(text):
            if len(tok) > 0:
                toks.append(Tok(_get_pos_tag(tok),
                                tok.lower(),
                                tok.lower(),
                                ent_type='',
                                tag=''))
        return Doc([toks], text)

    return tokenize

    Parameters
    ----------
    nltk_tokenizer : nltk.tokenize.* instance (e.g., nltk.TreebankWordTokenizer())

    Returns
    -------
    Doc of tweets

    Notes
    -------
    Requires NLTK to be installed
    
scattertext/WhitespaceNLP.py