LoginSignup
0
0

More than 5 years have passed since last update.

めざせpythonライブラリマスター (40)wordsegmentation

Posted at

【ライブラリ説明】

 英文を単語に分割

【プログラム】

wordsegmentation.py
# -*- coding: utf-8 -*-

from wordsegmentation import WordSegment

ws = WordSegment()

print ws.segment('universityofwashington')
# ['university', 'of', 'washington']

print ws.segment('thisisatest')
# ['this', 'is', 'a', 'test']

print ws.segment('thisisanURLcontaining123345and-&**^&butitstillworks')
# ['this', 'is', 'an', 'url', 'containing', '123345', 'and', '-&**^&', 'but', 'it', 'still', 'works']

print ws.segment('NoMatterHowLongThisTextisTextThisTextMightBe')
# ['no', 'matter', 'how', 'long', 'this', 'text', 'is', 'text', 'this', 'text', 'might', 'be']

【参考サイト】

 pypi
 github

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0