Skip to content
This repository has been archived by the owner on Aug 15, 2020. It is now read-only.

Commit

Permalink
Fixing the tmp_file write fail #10
Browse files Browse the repository at this point in the history
Updated the encoding of "clf" to enable tmp_file write.
  • Loading branch information
dsouzadaniel authored Jul 18, 2018
1 parent 441e3d2 commit 91e8b1e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/machine_learning/crf.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ def predict(clf, X):
# Dump the model into a temp file
os_handle,tmp_file = tempfile.mkstemp(dir=tmp_dir, suffix="crf_temp")
with open(tmp_file, 'wb') as f:
f.write(clf)
clf_byte = bytearray(clf, 'latin1')
f.write(clf_byte)

# Create the Tagger object
tagger = pycrfsuite.Tagger()
Expand Down

0 comments on commit 91e8b1e

Please sign in to comment.