@chinawatdc/thai-nlp-utils 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # @chinawatdc/thai-nlp-utils
2
+
3
+ > ตัวแปลงคำอ่านภาษาไทย ค้นหาคำพ้องเสียง หรือตัวตัดคำ (Word break) แบบน้ำหนักเบา
4
+
5
+ ## 📌 แผนการพัฒนา (Roadmap)
6
+ 1. ออกแบบ API และโครงสร้างฟังก์ชันหลัก
7
+ 2. เขียนโค้ดด้วย TypeScript
8
+ 3. ทดสอบการทำงาน (Unit Tests)
9
+ 4. อัปโหลดขึ้น npm
10
+
11
+ ## 🚀 วิธีติดตั้ง (ในอนาคต)
12
+ ```bash
13
+ npm install @chinawatdc/thai-nlp-utils
14
+ ```
15
+
16
+ ## 📖 วิธีใช้งานเบื้องต้น
17
+ *รอการอัปเดตหลังจากพัฒนาเสร็จสิ้น...*
@@ -0,0 +1,4 @@
1
+ declare function cleanThaiText(text: string): string;
2
+ declare function isThai(text: string): boolean;
3
+
4
+ export { cleanThaiText, isThai };
@@ -0,0 +1,4 @@
1
+ declare function cleanThaiText(text: string): string;
2
+ declare function isThai(text: string): boolean;
3
+
4
+ export { cleanThaiText, isThai };
package/dist/index.js ADDED
@@ -0,0 +1,36 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/index.ts
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
+ cleanThaiText: () => cleanThaiText,
23
+ isThai: () => isThai
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ function cleanThaiText(text) {
27
+ return text.replace(/[^\u0E00-\u0E7Fa-zA-Z0-9\s]/g, "").trim();
28
+ }
29
+ function isThai(text) {
30
+ return /[\u0E00-\u0E7F]/.test(text);
31
+ }
32
+ // Annotate the CommonJS export names for ESM import in node:
33
+ 0 && (module.exports = {
34
+ cleanThaiText,
35
+ isThai
36
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,11 @@
1
+ // src/index.ts
2
+ function cleanThaiText(text) {
3
+ return text.replace(/[^\u0E00-\u0E7Fa-zA-Z0-9\s]/g, "").trim();
4
+ }
5
+ function isThai(text) {
6
+ return /[\u0E00-\u0E7F]/.test(text);
7
+ }
8
+ export {
9
+ cleanThaiText,
10
+ isThai
11
+ };
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@chinawatdc/thai-nlp-utils",
3
+ "version": "1.0.0",
4
+ "main": "./dist/index.js",
5
+ "scripts": {
6
+ "build": "tsup src/index.ts --format cjs,esm --dts --clean",
7
+ "dev": "tsup src/index.ts --format cjs,esm --watch",
8
+ "test": "echo \"No test yet\""
9
+ },
10
+ "keywords": [],
11
+ "author": "",
12
+ "license": "ISC",
13
+ "description": "ตัวแปลงคำอ่านภาษาไทย ค้นหาคำพ้องเสียง หรือตัวตัดคำ (Word break) แบบน้ำหนักเบา",
14
+ "module": "./dist/index.mjs",
15
+ "types": "./dist/index.d.ts",
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.mjs",
20
+ "require": "./dist/index.js"
21
+ }
22
+ },
23
+ "devDependencies": {
24
+ "tsup": "^8.5.1",
25
+ "typescript": "^5.4.5"
26
+ }
27
+ }
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ export function cleanThaiText(text: string): string {
2
+ return text.replace(/[^\u0E00-\u0E7Fa-zA-Z0-9\s]/g, '').trim();
3
+ }
4
+
5
+ export function isThai(text: string): boolean {
6
+ return /[\u0E00-\u0E7F]/.test(text);
7
+ }