aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-08-18 13:12:46 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-08-18 13:12:46 -0700
commit66bd4dc85b165756f4f1924ff953813c899a9782 (patch)
treef0035fcf4f9591deef0bb6bef2a8bbd6d615c808
parentc5209e086026a57c03501ff9194e15b6b8b0f404 (diff)
fix: odd bug associated to non-unicode characters in stream
-rw-r--r--pangraph/utils.py5
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[:])