การตัดข้อความภาษาไทยโดยไม่นับสระลอยและวรรณยุกต์
Installation
This is a Node.js module available through the npm registry.
$ npm install --save @praphan.o/thai-sentence-cut
Usage
const { lengthOfThaiString, splitThaiStringByLength } = require('../src');
const str = "ประโยคยาวๆ ที่ใช้ทดสอบการตัดคำและการนับความยาวของตัวอักขระโดยไม่สนใจสระและวรรณยุกต์ไทย";
console.log(lengthOfThaiString(s));
// output:
// 76
console.log(splitThaiStringByLength(s,20));
// output:
// [ 'ประโยคยาวๆ ที่ใช้ทดสอบ',
// 'การตัดคำและการนับความ',
// 'ยาวของตัวอักขระโดยไม่',
// 'สนใจสระและวรรณยุกต์ไทย' ]
Depends
Update
- 1.1.0 splitThaiStringByLength can split multi-line string (string with new line character)
- 1.1.1 update correct version
- 1.1.2 update dependencies to avoid vulnerabilities
- 1.1.3 just update readme (sorry for this)
- 1.1.4 update repository url
- 1.1.5 update dependencies
- 1.1.6 typescript support