Skip to content

Instantly share code, notes, and snippets.

@naotokui
Created May 9, 2017 01:28
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naotokui/4296a2cb8debaf5938af2d6fc3feabd1 to your computer and use it in GitHub Desktop.
Save naotokui/4296a2cb8debaf5938af2d6fc3feabd1 to your computer and use it in GitHub Desktop.
Japanese sentence tokenizer - 日本語 - 文に分ける 簡易版
import re
import nltk
sent_detector = nltk.RegexpTokenizer(u'[^ !?。]*[!?。.\n]')
sents = sent_detector.tokenize(u" 原子番号92のウランより重い元素は全て人工的に合成され、118番まで発見の報告がある。\
113番については、理研と米露の共同チームがそれぞれ「発見した」と報告し、国際純正・応用化学連合と国際純粋・応用物理学連合の合同作業部会が審査していた。両学会は「データの確実性が高い」ことを理由に、理研の発見を認定し、31日に森田さんに通知した。未確定だった115番と117番、118番の新元素は米露チームの発見を認めた。森田さんは「周期表に名前が残ることは感慨深い。大勢の共同研究者にまずは感謝したい」と述べた。 \n")
for s in sents:
print s, len(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment