Update text.py

"characters" was a bad variable name now that I think about it
This commit is contained in:
Robert Gale 2019-08-01 12:14:13 -07:00 committed by GitHub
parent 8ec6ac8079
commit a3e0e9f9bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,10 +52,10 @@ def text_to_char_array(original, alphabet):
Given a Python string ``original``, remove unsupported characters, map characters
to integers and return a numpy array representing the processed string.
"""
characters = np.asarray([alphabet.label_from_string(c) for c in original])
if characters.shape[0] == 0:
integers = np.asarray([alphabet.label_from_string(c) for c in original])
if integers.shape[0] == 0:
raise Exception("Found an empty transcript! You must include a transcript for all training data.")
return characters
return integers
# The following code is from: http://hetland.org/coding/python/levenshtein.py