diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2020-08-18 13:12:46 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2020-08-18 13:12:46 -0700 |
commit | 66bd4dc85b165756f4f1924ff953813c899a9782 (patch) | |
tree | f0035fcf4f9591deef0bb6bef2a8bbd6d615c808 | |
parent | c5209e086026a57c03501ff9194e15b6b8b0f404 (diff) |
fix: odd bug associated to non-unicode characters in stream
-rw-r--r-- | pangraph/utils.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pangraph/utils.py b/pangraph/utils.py index e0d85fa..5d5e888 100644 --- a/pangraph/utils.py +++ b/pangraph/utils.py @@ -97,7 +97,10 @@ def as_array(x): return np.array(list(x)) def as_string(x): - return x.view(f'U{x.size}')[0] + try: + return x.view(f'U{x.size}')[0] + except: + return "".join(str(c) for c in x) def flatten(x): return np.ndarray.flatten(x[:]) |