Skip to content

Commit

Permalink
fix: exports
Browse files Browse the repository at this point in the history
  • Loading branch information
severinsimmler committed Apr 25, 2019
1 parent 5c8c5a3 commit 7bdccb6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/cophi/text/model.py
Expand Up @@ -710,7 +710,7 @@ def plaintext(cls, dtm, filepath):
document = document.dropna()
features = [" ".join([word] * int(freq))
for word, freq in document.iteritems()]
export = "{title} {title} {features}\n".format(
export = "{title} {features}\n".format(
title=title, features=" ".join(features))
file.write(export)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_model.py
Expand Up @@ -292,11 +292,11 @@ def test_svmlight(self, corpus):
model.Corpus.svmlight(corpus.dtm, output)
assert output.exists()
with output.open("r", encoding="utf-8") as file:
assert file.read() == "document document a:3 b:2 c:3 d:1 e:1 f:1\n"
assert file.read() == "document a:3 b:2 c:3 d:1 e:1 f:1\n"

def test_plaintext(self, corpus):
output = pathlib.Path("corpus.txt")
model.Corpus.plaintext(corpus.dtm, output)
assert output.exists()
with output.open("r", encoding="utf-8") as file:
assert file.read() == "document document a a a b b c c c d e f\n"
assert file.read() == "document a a a b b c c c d e f\n"

0 comments on commit 7bdccb6

Please sign in to comment.