Created
August 26, 2010 11:35
-
-
Save laiso/551254 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# coding: utf-8 | |
import unicodedata | |
def ishirakata(text): | |
text = unicodedata.normalize('NFKD', text) | |
for u in text: | |
name = unicodedata.name(u) | |
if name.startswith("HIRAGANA") or\ | |
name.startswith("KATAKANA"): | |
return True | |
return False | |
import nose | |
from nose.tools import * | |
ok_(ishirakata(u"というか普通に間に合わない")) | |
ok_(ishirakata(u"修正箇所の修正は出来た。")) | |
eq_(ishirakata(u"東京都台東区上野9-13-2"), False) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment