Skip to content

Commit

Permalink
fix: staticmethod -> classmethod
Browse files Browse the repository at this point in the history
  • Loading branch information
severinsimmler committed Dec 23, 2018
1 parent 9c12e8b commit 6b01a15
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/cophi/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def parse_xml(self, parser=lxml.etree.XMLParser()):
"""
return lxml.etree.parse(str(self.filepath), parser=parser)

@staticmethod
@classmethod
def stringify(tree):
"""Serialize to an encoded string representation of its XML tree.
Expand Down Expand Up @@ -230,7 +230,7 @@ def freq_spectrum(self):
bow = collections.Counter(self.tokens) # no pandas needed here
return pd.Series(collections.Counter(bow.values()))

@staticmethod
@classmethod
def drop(tokens, features):
"""Drop features.
Expand Down Expand Up @@ -365,7 +365,7 @@ def count_corpus(documents):
self.dtm = matrix(counts)
self.dtm = self.dtm.T

@staticmethod
@classmethod
def map_metadata(data, metadata, uuid="uuid", fields=["title"], sep="_"):
"""Map metadata with a UUID.
Expand Down Expand Up @@ -410,7 +410,7 @@ def types(self):
"""
return list(self.dtm.columns)

@staticmethod
@classmethod
def sort(dtm):
"""Descending sorted document-term matrix.
Expand Down Expand Up @@ -444,7 +444,7 @@ def hapax(self):
"""
return list(self.dtm.loc[:, self.dtm.max() == 1].columns)

@staticmethod
@classmethod
def drop(dtm, features):
"""Drop features from document-term matrix.
Expand All @@ -455,7 +455,7 @@ def drop(dtm, features):
features = [token for token in features if token in dtm.columns]
return dtm.drop(features, axis=1)

@staticmethod
@classmethod
def cull(dtm, ratio=None, threshold=None, keepna=False):
"""Remove features that do not appear in a minimum of documents.
Expand Down Expand Up @@ -677,7 +677,7 @@ def orlov_z(self, max_iterations=100, min_tolerance=1):
max_iterations,
min_tolerance)

@staticmethod
@classmethod
def svmlight(dtm, filepath):
"""Export corpus to SVMLight format.
Expand All @@ -695,7 +695,7 @@ def svmlight(dtm, filepath):
title=title, features=" ".join(features))
file.write(export)

@staticmethod
@classmethod
def plaintext(dtm, filepath):
"""Export corpus to plain text format.
Expand Down

0 comments on commit 6b01a15

Please sign in to comment.