Skip to content

Commit

Permalink
fix windows eoferror
Browse files Browse the repository at this point in the history
  • Loading branch information
isnowfy committed Dec 8, 2013
1 parent 46080ff commit 8532c34
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def read(fname):

setup(
name='snownlp',
version='0.8',
version='0.9',
description='Python library for processing Chinese text',
author='isnowfy',
url='https://github.com/isnowfy/snownlp',
Expand Down
4 changes: 2 additions & 2 deletions snownlp/classification/bayes.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ def save(self, fname):
d['d'] = {}
for k, v in self.d.iteritems():
d['d'][k] = v.__dict__
marshal.dump(d, open(fname, 'w'))
marshal.dump(d, open(fname, 'wb'))

def load(self, fname):
d = marshal.load(open(fname, 'r'))
d = marshal.load(open(fname, 'rb'))
self.total = d['total']
self.d = {}
for k, v in d['d'].iteritems():
Expand Down
4 changes: 2 additions & 2 deletions snownlp/utils/tnt.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def save(self, fname):
d[k] = v.__dict__
else:
d[k] = v
marshal.dump(d, open(fname, 'w'))
marshal.dump(d, open(fname, 'wb'))

def load(self, fname):
d = marshal.load(open(fname, 'r'))
d = marshal.load(open(fname, 'rb'))
for k, v in d.iteritems():
if isinstance(self.__dict__[k], set):
self.__dict__[k] = set(v)
Expand Down

0 comments on commit 8532c34

Please sign in to comment.