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

Function unicodeToAscii

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

Source from the content-addressed store, hash-verified

182# Turn a Unicode string to plain ASCII, thanks to
183# https://stackoverflow.com/a/518232/2809427
184def unicodeToAscii(s):
185 return ''.join(
186 c for c in unicodedata.normalize('NFD', s)
187 if unicodedata.category(c) != 'Mn'
188 )
189
190# Lowercase, trim, and remove non-letter characters
191def normalizeString(s):

Callers 1

normalizeStringFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected