MCPcopy Create free account
hub / github.com/pytorch/tutorials / normalizeString

Function normalizeString

intermediate_source/seq2seq_translation_tutorial.py:191–195  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

189
190# Lowercase, trim, and remove non-letter characters
191def normalizeString(s):
192 s = unicodeToAscii(s.lower().strip())
193 s = re.sub(r"([.!?])", r" \1", s)
194 s = re.sub(r"[^a-zA-Z!?]+", r" ", s)
195 return s.strip()
196
197
198######################################################################

Callers 1

readLangsFunction · 0.70

Calls 1

unicodeToAsciiFunction · 0.70

Tested by

no test coverage detected