Exemple #1
0
def test_docs_from_document_term_matrix():
    dtm = [[2, 1], [3, 2]]
    docs = [[0, 0, 1], [0, 0, 0, 1, 1]]
    assert utils.docs_from_document_term_matrix(dtm) == docs
Exemple #2
0
def test_docs_from_dtm_with_gaps():
    dtm = [[2, 0, 1], [1, 1, 1]]
    docs = [[0, 0, 2], [0, 1, 2]]
    assert utils.docs_from_document_term_matrix(dtm) == docs
Exemple #3
0
def test_docs_from_numpy_dtp():
    dtm = np.array([[2, 1], [3, 2]])
    docs = [[0, 0, 1], [0, 0, 0, 1, 1]]
    assert utils.docs_from_document_term_matrix(dtm) == docs
Exemple #4
0
def test_docs_from_document_term_matrix_with_vocab():
    dtm = [[2, 1], [3, 2]]
    docs = [['cat', 'cat', 2], ['cat', 'cat', 'cat', 2, 2]]
    gen_docs = utils.docs_from_document_term_matrix(dtm, vocab=['cat', 2])
    assert gen_docs == docs
def test_docs_from_document_term_matrix():
    dtm = [[2, 1], [3, 2]]
    docs = [[0, 0, 1], [0, 0, 0, 1, 1]]
    assert utils.docs_from_document_term_matrix(dtm) == docs
def test_docs_from_numpy_dtp():
    dtm = np.array([[2, 1], [3, 2]])
    docs = [[0, 0, 1], [0, 0, 0, 1, 1]]
    assert utils.docs_from_document_term_matrix(dtm) == docs
def test_docs_from_dtm_with_gaps():
    dtm = [[2, 0, 1], [1, 1, 1]]
    docs = [[0, 0, 2], [0, 1, 2]]
    assert utils.docs_from_document_term_matrix(dtm) == docs
def test_docs_from_document_term_matrix_with_vocab():
    dtm = [[2, 1], [3, 2]]
    docs = [['cat', 'cat', 2], ['cat', 'cat', 'cat', 2, 2]]
    gen_docs = utils.docs_from_document_term_matrix(dtm, vocab=['cat', 2])
    assert gen_docs == docs