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

Method clean_str

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

Source from the content-addressed store, hash-verified

18 self.nlp = None
19
20 def clean_str(self, string):
21 string = re.sub(self.other_char, " ", string)
22 string = re.sub(r"\'s", " \'s", string)
23 string = re.sub(r"\'ve", " \'ve", string)
24 string = re.sub(r"n\'t", " n\'t", string)
25 string = re.sub(r"\'re", " \'re", string)
26 string = re.sub(r"\'d", " \'d", string)
27 string = re.sub(r"\'ll", " \'ll", string)
28 string = re.sub(r",", " , ", string)
29 string = re.sub(r"!", " ! ", string)
30 string = re.sub(r"\(", " \( ", string)
31 string = re.sub(r"\)", " \) ", string)
32 string = re.sub(r"\?", " \? ", string)
33 string = re.sub(r"\s{2,}", " ", string)
34
35 return string.strip().lower()
36
37 def norm_str(self, string):
38 string = re.sub(self.other_char, " ", string)

Callers 1

clean_textMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected