Uniscripts
Simple Python 3 module to access Unicode UCD script metadata (as per UAX #24)
Install / Use
/learn @melissaboiko/UniscriptsREADME
Simple Python 3 module to query Unicode UCD script metadata (see UAX #24).
This module is useful for querying if a text is made of Latin characters, Arabic, hiragana, kanji (han), and so on. It works for all scripts supported by the Unicode character database.
This module is dumb and slow. If you need speed, you probably want to
implement your own functions. See e.g. man pcreunicode, man pcrepattern
(grep -P supports \p). As of this writing, the next-generation of Python
regexpes, available as the pypi library regex, also supports \p.
Sample usage:
>>> import uniscripts
>>> uniscripts.is_script('A', 'Latin')
True
# if you pass it a string, all characters must match
>>> uniscripts.is_script('はるはあけぼの', 'Hiragana')
True
>>> uniscripts.is_script('はるはAkebono', 'Hiragana')
False
# ...but by default, it ignores 'Common' characters, such as punctuation.
>>> uniscripts.is_script('はるは:あけぼの', 'Hiragana')
True
>>> uniscripts.is_script('中華人民共和国', 'Han') # 'Han' = kanji or hànzì
True
>>> uniscripts.which_scripts('z')
['Latin']
>>> uniscripts.which_scripts('は')
['Hiragana']
>>> uniscripts.which_scripts('ー') # U+30FC
['Common', 'Katakana', 'Hiragana', 'Hangul', 'Han', 'Bopomofo', 'Yi']
See docstrings for is_script(), which_scripts().
Related Skills
node-connect
353.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
353.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
353.3kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
