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

Function unicodeToAscii

intermediate_source/char_rnn_generation_tutorial.py:96–101  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

94
95# Turn a Unicode string to plain ASCII, thanks to https://stackoverflow.com/a/518232/2809427
96def unicodeToAscii(s):
97 return ''.join(
98 c for c in unicodedata.normalize('NFD', s)
99 if unicodedata.category(c) != 'Mn'
100 and c in all_letters
101 )
102
103# Read a file and split into lines
104def readLines(filename):

Callers 2

readLinesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected