Showing posts with label libthai. Show all posts
Showing posts with label libthai. Show all posts

PHP extension for Thai word break


ทดลองเขียน php extension เป็นการตัดคำโดยใช้ libthai ต้องขอบคุณ พี่เทพ สำหรับคำแนะนำ
ได้ผลลัพธ์ตามรูปแต่ยังไม่สมบูรณ์เพราะยังต้องใช้ iconv ของ php ช่วยก่อนจะส่งไปให้  th_brk_line() แล้วก็ยังอีกหลายเรื่องที่ต้องแก้ไข

php:

 $str="การบ้านเยอะมากสงสัยไม่เสร็จแน่เลยนอนตากลมอยู่บ้านดีกว่า";
 $new = th_brk_line(iconv('UTF-8','TIS-620',$str));
 echo iconv('TIS-620','UTF-8',$new);

output:



ref:
http://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/
http://linux.thai.net/pub/thailinux/software/libthai/doc/libthai-0.1.7/