ashvardanian / StringZilla

Up to 10x faster strings for C, C++, Python, Rust, and Swift, leveraging SWAR and SIMD on Arm Neon and x86 AVX2 & AVX-512-capable chips to accelerate search, sort, edit distances, alignment scores, etc 🦖
https://ashvardanian.com/posts/stringzilla/
Apache License 2.0
1.92k stars 64 forks source link

Pretty-printing `Strs` in Python #131

Closed ashvardanian closed 3 months ago

ashvardanian commented 3 months ago

The Str Python class already provides nice visualizations for Jupyter. Let's provide one for Strs and File.

image

alexbowe commented 3 months ago

Do we want the File representation to be similar to the Python built-in file type? That is, display the user-provided/default parameters rather than its (truncated) contents?

Here is an example of how Python does it:

>>> open("sample_data/california_housing_test.csv", "r")
<_io.TextIOWrapper name='sample_data/california_housing_test.csv' mode='r' encoding='UTF-8'>

Also, how is this for a representation of Strs: sz.Strs([sz.Str('A'), sz.Str('B'), ..., sz.Str('Z')])

(I think Jupyter handles the truncation in its own formatter so the Strs_repr function might not need to consider it, but I need to look into that)

ashvardanian commented 3 months ago

@alexbowe, I think the sz.Strs([sz.Str('A'), sz.Str('B'), ..., sz.Str('Z')]) may be too mouthful, but the sz.Strs(['A', 'B', 'B'...]) would be great!

ashvardanian commented 3 months ago

:tada: This issue has been resolved in version 3.8.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: