Skip to content

Instantly share code, notes, and snippets.

@laiso
Created August 26, 2010 11:35
Show Gist options
  • Save laiso/551254 to your computer and use it in GitHub Desktop.
Save laiso/551254 to your computer and use it in GitHub Desktop.
#!/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