MCPcopy Create free account
hub / github.com/THUDM/GLM / clean_text

Function clean_text

tasks/data_utils.py:32–40  ·  view source on GitHub ↗

Remove new lines and multiple spaces and adjust end of sentence dot.

(text)

Source from the content-addressed store, hash-verified

30
31
32def clean_text(text):
33 """Remove new lines and multiple spaces and adjust end of sentence dot."""
34
35 text = text.replace("\n", " ")
36 text = re.sub(r'\s+', ' ', text)
37 for _ in range(3):
38 text = text.replace(' . ', '. ')
39
40 return text
41
42
43class InputExample(object):

Callers 1

_create_examplesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected