24 พฤษภาคม 2558

Published พฤษภาคม 24, 2558 by with 0 comment

ตัดคำภาษาอังกฤษด้วยภาษา Python

สวัสดีผู้อ่านทุกท่านครับ บทคามนี้ผมจะพาผู้อ่านไปตัดคำภาษาอังกฤษด้วยภาษา Python กันครับ

ในการตัดคำภาษาอังกฤษด้วยภาษา Python ผมขอแนะนำโมดูล wordsegment ครับ

โมดูล wordsegment เป็นโมดูลสำหรับใช้ตัดคำภาษาอังกฤษ โดยใช้ข้อมูลจากฐานข้อมูลของ Google Web Trillion Word Corpus มีข้อมูล unigram กว่า 333,000 คำ และข้อมูล bigram กว่า 250000 วลี

  • รองรับทั้ง Python 2 และ Python 3

  • ใช้ License: Apache License, Version 2.0


สามารถติดตั้งได้โดยใช้คำสั่ง pip:
$ pip install wordsegment

การใช้งาน
สามารถใช้งานได้ง่าย ๆ ตามนี้ครับ

[python]
>>> from wordsegment import segment
>>> segment('thisisatest')
['this', 'is', 'a', 'test']
[/python]

หน้าหลักโมดูล wordsegment http://www.grantjenks.com/blog/portfolio-post/english-word-segmentation-python/
ติดตามบทความต่อไปนะครับ
ขอบคุณครับ

0 ความคิดเห็น:

แสดงความคิดเห็น

แสดงความคิดเห็นได้ครับ :)