Failed
tests.test_api.test_export (from pytest)
Failing for the past 3 builds
(Since Failed )
This test is unclaimed |
Error Message
NameError: name 'matrix' is not defined
Stacktrace
corpus = <cophi.model.Corpus object at 0x7f933bba74e0> def test_export(corpus): output = pathlib.Path("corpus.svmlight") cophi.export(corpus.dtm, output, "svmlight") assert output.exists() with output.open("r", encoding="utf-8") as file: assert file.read() == "document document a:1 b:1 c:1 d:1 e:1 f:1\n" output = pathlib.Path("corpus.txt") > cophi.export(corpus.dtm, output, "text") tests/test_api.py:41: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ src/cophi/api.py:96: in export cophi.utils.export_plaintext(dtm, filepath) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ dtm = a b c d e f document 1 1 1 1 1 1 filepath = PosixPath('corpus.txt') def export_plaintext(dtm, filepath): """Export document-term matrix to plain text format. Parameters: dtm: Document-term matrix. filepath: Path to output file. """ with pathlib.Path(filepath).open("w", encoding="utf-8") as file: > for title, document in matrix.iterrows(): E NameError: name 'matrix' is not defined src/cophi/utils.py:144: NameError