Repository navigation
Welcome to Python-Practice-Repository Discussions !!! #3
hasheramin5-cyber
announced in
Announcements
Replies: 1 comment 1 reply
|
A small Python exercise idea for a resource-catalog search: compare text entered with full-width and ASCII characters while keeping the original title for display. import unicodedata
def search_key(text):
return unicodedata.normalize("NFKC", text).casefold()
assert search_key("小学英语,数学") == search_key("小学英语,数学")
assert search_key("学习资料AI") == search_key("学习资料AI")I ran those two assertions with Python on synthetic examples. An extension could add one case where normalization changes a character the application wishes to preserve, and decide whether that equivalence is appropriate before using it for deduplication. NFKC is a matching choice, not a reason to overwrite a user's original filename. I help operate Resource Planet, a Chinese learning-resource catalog. This is a proposed practice fixture; I have not established that our production search uses this algorithm. The example was prepared with AI assistance. |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Welcome!
Welcome to the Python-Practice-Repository Discussions!
This repository is built for practicing Python through structured, hands-on exercises, examples, and projects.
Use Discussions to:
Before posting
Please:
Let's learn, practice, and build together.
All reactions