def toy_corpus(plain_corpus, is_filename=False, encoding='utf8', nltk_stop=False,
               stop_freq=0, add_stop=None, decode=False,
               metadata=None, autolabel=False, tokenizer=word_tokenize, simple=False):
    if is_filename:
        if encoding == 'detect':
            encoding = detect_encoding(plain_corpus)

        with open(plain_corpus, 'rb', encoding=encoding) as f:
            plain_corpus = f.read()

    if decode:
        plain_corpus = unidecode(plain_corpus)

    docs = paragraph_tokenize(plain_corpus)
    docs = [tokenizer(d) for d in docs]

    corpus = sum(docs, [])
    tok = np.cumsum(np.array([len(d) for d in docs]))

    if not metadata and autolabel:
        metadata = ['Document {0}'.format(i) for i in range(len(tok))]

    if metadata:
        if not len(metadata) == len(tok):
            msg = 'Metadata mismatch: metadata length is {0} and number'\
                   'of documents is {1}'.format(len(metadata), len(tok))
            raise Exception(msg)
        else:
            dtype = [('idx', np.array(tok).dtype),
                     ('document_label', np.array(metadata).dtype)]
            tok = np.array(zip(tok, metadata), dtype=dtype)
    else:
        dtype = [('idx', np.array(tok).dtype)]
        tok = np.array([(i,) for i in tok], dtype=dtype)
    
    c = Corpus(corpus, context_data=[tok], context_types=['document'])
    if nltk_stop or stop_freq or add_stop:
        c = apply_stoplist(c, nltk_stop=nltk_stop,
                              freq=stop_freq, add_stop=add_stop)
    return c
Returns tuple of (session-id (str), capabilities (Capabilities)
dataset/ETHPy150Open inpho/vsm/vsm/extensions/corpusbuilders/corpusbuilders.py/toy_corpus--crossover with--dataset/ETHPy150Open ncclient/ncclient/ncclient/transport/session.py/HelloHandler.parse