MCPcopy Index your code
hub / github.com/pytorch/tutorials / normalizeString

Function normalizeString

beginner_source/chatbot_tutorial.py:340–345  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

338
339# Lowercase, trim, and remove non-letter characters
340def normalizeString(s):
341 s = unicodeToAscii(s.lower().strip())
342 s = re.sub(r"([.!?])", r" \1", s)
343 s = re.sub(r"[^a-zA-Z.!?]+", r" ", s)
344 s = re.sub(r"\s+", r" ", s).strip()
345 return s
346
347# Read query/response pairs and return a voc object
348def readVocs(datafile, corpus_name):

Callers 2

readVocsFunction · 0.70
evaluateInputFunction · 0.70

Calls 1

unicodeToAsciiFunction · 0.70

Tested by

no test coverage detected