Skip to content

Commit

Permalink
Make __save_corpus weakly private
Browse files Browse the repository at this point in the history
  • Loading branch information
anotherbugmaster committed Nov 23, 2017
1 parent 34cccfe commit 34bd9ef
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion gensim/corpora/bleicorpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def line2doc(self, line):
return doc

@staticmethod
def __save_corpus(fname, corpus, id2word=None, metadata=False):
def _save_corpus(fname, corpus, id2word=None, metadata=False):
"""
Save a corpus in the LDA-C format.
Expand Down
2 changes: 1 addition & 1 deletion gensim/corpora/lowcorpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def __iter__(self):
yield self.line2doc(line)

@staticmethod
def __save_corpus(fname, corpus, id2word=None, metadata=False):
def _save_corpus(fname, corpus, id2word=None, metadata=False):
"""
Save a corpus in the List-of-words format.
Expand Down
2 changes: 1 addition & 1 deletion gensim/corpora/malletcorpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def line2doc(self, line):
return doc

@staticmethod
def __save_corpus(fname, corpus, id2word=None, metadata=False):
def _save_corpus(fname, corpus, id2word=None, metadata=False):
"""
Save a corpus in the Mallet format.
Expand Down
2 changes: 1 addition & 1 deletion gensim/corpora/mmcorpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __iter__(self):
yield doc # get rid of doc id, return the sparse vector only

@staticmethod
def __save_corpus(fname, corpus, id2word=None, progress_cnt=1000, metadata=False):
def _save_corpus(fname, corpus, id2word=None, progress_cnt=1000, metadata=False):
"""
Save a corpus in the Matrix Market format to disk.
Expand Down
4 changes: 2 additions & 2 deletions gensim/corpora/sharded_corpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ def load(cls, fname, mmap=None):
return super(ShardedCorpus, cls).load(fname, mmap)

@staticmethod
def __save_corpus(fname, corpus, id2word=None, progress_cnt=1000, metadata=False, **kwargs):
def _save_corpus(fname, corpus, id2word=None, progress_cnt=1000, metadata=False, **kwargs):
"""
Implement a serialization interface. Do not call directly;
use the `serialize` method instead.
Expand Down Expand Up @@ -809,4 +809,4 @@ def serialize(serializer, fname, corpus, id2word=None, index_fname=None, progres
Ignore the parameters id2word, index_fname, progress_cnt, labels
and metadata. They currently do nothing and are here only to
provide a compatible method signature with superclass."""
serializer.__save_corpus(fname, corpus, id2word=id2word, progress_cnt=progress_cnt, metadata=metadata, **kwargs)
serializer._save_corpus(fname, corpus, id2word=id2word, progress_cnt=progress_cnt, metadata=metadata, **kwargs)
2 changes: 1 addition & 1 deletion gensim/corpora/svmlightcorpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __iter__(self):
self.length = lineno + 1

@staticmethod
def __save_corpus(fname, corpus, id2word=None, labels=False, metadata=False):
def _save_corpus(fname, corpus, id2word=None, labels=False, metadata=False):
"""
Save a corpus in the SVMlight format.
Expand Down
2 changes: 1 addition & 1 deletion gensim/corpora/ucicorpus.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def create_dictionary(self):
return dictionary

@staticmethod
def __save_corpus(fname, corpus, id2word=None, progress_cnt=10000, metadata=False):
def _save_corpus(fname, corpus, id2word=None, progress_cnt=10000, metadata=False):
"""
Save a corpus in the UCI Bag-of-Words format.
Expand Down
4 changes: 2 additions & 2 deletions gensim/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ def __len__(self):
# return sum(1 for doc in self) # sum(empty generator) == 0, so this works even for an empty corpus

@staticmethod
def __save_corpus(fname, corpus, id2word=None, metadata=False):
def _save_corpus(fname, corpus, id2word=None, metadata=False):
"""
Save an existing `corpus` to disk.
Some formats also support saving the dictionary (`feature_id->word` mapping),
which can in this case be provided by the optional `id2word` parameter.
>>> MmCorpus.__save_corpus('file.mm', corpus)
>>> MmCorpus._save_corpus('file.mm', corpus)
Some corpora also support an index of where each document begins, so
that the documents on disk can be accessed in O(1) time (see the
Expand Down

0 comments on commit 34bd9ef

Please sign in to comment.