MCPcopy Index your code
hub / github.com/chengsen/PyTorch_TextGCN / remove_stopword

Method remove_stopword

data_processor.py:67–81  ·  view source on GitHub ↗
(self, string)

Source from the content-addressed store, hash-verified

65 return string.strip().lower()
66
67 def remove_stopword(self, string):
68 if self.stop_words is None:
69 from nltk.corpus import stopwords
70 self.stop_words = set(stopwords.words('english'))
71
72 if type(string) is str:
73 string = string.split()
74
75 new_string = list()
76 for word in string:
77 if word in self.stop_words:
78 continue
79 new_string.append(word)
80
81 return " ".join(new_string)
82
83 def replace_num(self, string):
84 result = re.sub(self.num, '<num>', string)

Callers 1

clean_textMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected