pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/textproc/split-thai
Module Name: pkgsrc
Committed By: scole
Date: Tue Sep 29 01:01:20 UTC 2020
Modified Files:
pkgsrc/textproc/split-thai: Makefile
pkgsrc/textproc/split-thai/files: thai-utility.el
Log Message:
Update to 1.0
- small clean ups
- add thai-word-table-in-p and split-thai-word to thai-utility.el
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 pkgsrc/textproc/split-thai/Makefile
cvs rdiff -u -r1.6 -r1.7 pkgsrc/textproc/split-thai/files/thai-utility.el
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/textproc/split-thai/Makefile
diff -u pkgsrc/textproc/split-thai/Makefile:1.10 pkgsrc/textproc/split-thai/Makefile:1.11
--- pkgsrc/textproc/split-thai/Makefile:1.10 Sat Sep 5 18:02:36 2020
+++ pkgsrc/textproc/split-thai/Makefile Tue Sep 29 01:01:20 2020
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.10 2020/09/05 18:02:36 scole Exp $
+# $NetBSD: Makefile,v 1.11 2020/09/29 01:01:20 scole Exp $
-PKGNAME= split-thai-0.9
+PKGNAME= split-thai-1.0
CATEGORIES= textproc
MAINTAINER= pkgsrc-users%NetBSD.org@localhost
COMMENT= Utilities to split UTF-8 Thai text into words
Index: pkgsrc/textproc/split-thai/files/thai-utility.el
diff -u pkgsrc/textproc/split-thai/files/thai-utility.el:1.6 pkgsrc/textproc/split-thai/files/thai-utility.el:1.7
--- pkgsrc/textproc/split-thai/files/thai-utility.el:1.6 Wed Aug 19 16:52:25 2020
+++ pkgsrc/textproc/split-thai/files/thai-utility.el Tue Sep 29 01:01:20 2020
@@ -1,3 +1,4 @@
+(require 'thingatpt)
(require 'mule-util)
(require 'thai-word)
@@ -32,14 +33,24 @@ uses recursion"
;; 1 => word at this depth
((equal complete 1)
(append (list thaistr)
- (extract-thai-na (cddr nlist) thaistr) '()))
+ (extract-thai-na (cddr nlist) thaistr)))
(t
(error "invalid parsing for complete var"))))
;; not finished
(t
(append (extract-thai-na (car nlist) thaistr)
- (extract-thai-na (cdr nlist) thaistr) '())))))
+ (extract-thai-na (cdr nlist) thaistr))))))
+
+(defun thai-word-table-in-p(thaiword)
+ "return t if thaiword is in 'thai-word-table, nil otherwise"
+ (let ((first (string-to-char (substring-no-properties thaiword 0 1)))
+ (elem)
+ (thaiwords))
+ (setq elem (assq first (cdr thai-word-table)))
+ (setq thaiwords (extract-thai-na elem ""))
+ (if (and elem thaiwords (member thaiword thaiwords))
+ t nil)))
(defun thai-word-table-save(filename &optional alist)
"save thai words extracted from a nested-alist table to
@@ -164,6 +175,26 @@ dictionary words."
(write-region nil nil lispfile))
line_count))
+(defun split-thai-word()
+ "Break Thai word at point by inserting spaces at word
+boundaries. (wrapper for 'thai-break-words)"
+ (interactive)
+ (let* ((start (point))
+ (bounds (bounds-of-thing-at-point 'word))
+ (p1 (car bounds))
+ (p2 (cdr bounds))
+ (instr (buffer-substring-no-properties p1 p2))
+ (outstr))
+ (with-temp-buffer
+ (insert instr)
+ (goto-char(point-min))
+ (thai-break-words " ")
+ (split-thai-numbers (point-min) (point-max))
+ (setq outstr (buffer-string)))
+ (delete-region p1 p2)
+ (insert outstr)
+ (goto-char start)))
+
(defun split-thai-line()
"Break Thai words from point to end of line by inserting a
space at word boundaries. (wrapper for 'thai-break-words)"
Home |
Main Index |
Thread Index |
Old Index