Skip to content

Instantly share code, notes, and snippets.

@tamuhey
Last active August 14, 2019 03:18
Show Gist options
  • Save tamuhey/d614a8aa4bdb8306ddd4ae973afdc7bc to your computer and use it in GitHub Desktop.
Save tamuhey/d614a8aa4bdb8306ddd4ae973afdc7bc to your computer and use it in GitHub Desktop.
List of all unicode's parentheses
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"List of all unicode's parentheses"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"import re\n",
"import unicodedata\n",
"parentheses_start_list = [chr(i) for i in range(0x10000) if unicodedata.category(chr(i)) == \"Ps\"]\n",
"parentheses_end_list = [chr(i) for i in range(0x10000) if unicodedata.category(chr(i)) == \"Pe\"]"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"with open(\"parentheses.json\", \"w\") as f:\n",
" json.dump({\"Ps\": parentheses_start_list, \"Pe\": parentheses_end_list}, f)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "nlp3",
"language": "python",
"name": "nlp3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.9"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
{"Ps": ["(", "[", "{", "\u0f3a", "\u0f3c", "\u169b", "\u201a", "\u201e", "\u2045", "\u207d", "\u208d", "\u2308", "\u230a", "\u2329", "\u2768", "\u276a", "\u276c", "\u276e", "\u2770", "\u2772", "\u2774", "\u27c5", "\u27e6", "\u27e8", "\u27ea", "\u27ec", "\u27ee", "\u2983", "\u2985", "\u2987", "\u2989", "\u298b", "\u298d", "\u298f", "\u2991", "\u2993", "\u2995", "\u2997", "\u29d8", "\u29da", "\u29fc", "\u2e22", "\u2e24", "\u2e26", "\u2e28", "\u2e42", "\u3008", "\u300a", "\u300c", "\u300e", "\u3010", "\u3014", "\u3016", "\u3018", "\u301a", "\u301d", "\ufd3f", "\ufe17", "\ufe35", "\ufe37", "\ufe39", "\ufe3b", "\ufe3d", "\ufe3f", "\ufe41", "\ufe43", "\ufe47", "\ufe59", "\ufe5b", "\ufe5d", "\uff08", "\uff3b", "\uff5b", "\uff5f", "\uff62"], "Pe": [")", "]", "}", "\u0f3b", "\u0f3d", "\u169c", "\u2046", "\u207e", "\u208e", "\u2309", "\u230b", "\u232a", "\u2769", "\u276b", "\u276d", "\u276f", "\u2771", "\u2773", "\u2775", "\u27c6", "\u27e7", "\u27e9", "\u27eb", "\u27ed", "\u27ef", "\u2984", "\u2986", "\u2988", "\u298a", "\u298c", "\u298e", "\u2990", "\u2992", "\u2994", "\u2996", "\u2998", "\u29d9", "\u29db", "\u29fd", "\u2e23", "\u2e25", "\u2e27", "\u2e29", "\u3009", "\u300b", "\u300d", "\u300f", "\u3011", "\u3015", "\u3017", "\u3019", "\u301b", "\u301e", "\u301f", "\ufd3e", "\ufe18", "\ufe36", "\ufe38", "\ufe3a", "\ufe3c", "\ufe3e", "\ufe40", "\ufe42", "\ufe44", "\ufe48", "\ufe5a", "\ufe5c", "\ufe5e", "\uff09", "\uff3d", "\uff5d", "\uff60", "\uff63"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment