pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/textproc/split-thai Update to 1.1



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c2caae8bb198
branches:  trunk
changeset: 439889:c2caae8bb198
user:      scole <scole%pkgsrc.org@localhost>
date:      Tue Sep 29 17:56:56 2020 +0000

description:
Update to 1.1
-------------
- in thai-utility.el update thai-word-table-in-p to use
  lookup-nested-alist, which is much faster and non-recursive

diffstat:

 textproc/split-thai/Makefile              |   4 ++--
 textproc/split-thai/files/thai-utility.el |  15 +++++++--------
 2 files changed, 9 insertions(+), 10 deletions(-)

diffs (37 lines):

diff -r ce5037d6b9e9 -r c2caae8bb198 textproc/split-thai/Makefile
--- a/textproc/split-thai/Makefile      Tue Sep 29 17:04:43 2020 +0000
+++ b/textproc/split-thai/Makefile      Tue Sep 29 17:56:56 2020 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.11 2020/09/29 01:01:20 scole Exp $
+# $NetBSD: Makefile,v 1.12 2020/09/29 17:56:56 scole Exp $
 
-PKGNAME=       split-thai-1.0
+PKGNAME=       split-thai-1.1
 CATEGORIES=    textproc
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
 COMMENT=       Utilities to split UTF-8 Thai text into words
diff -r ce5037d6b9e9 -r c2caae8bb198 textproc/split-thai/files/thai-utility.el
--- a/textproc/split-thai/files/thai-utility.el Tue Sep 29 17:04:43 2020 +0000
+++ b/textproc/split-thai/files/thai-utility.el Tue Sep 29 17:56:56 2020 +0000
@@ -43,14 +43,13 @@
              (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)))
+ "return t if thaiword is in 'thai-word-table, nil otherwise"
+  (let ((result
+        (lookup-nested-alist
+         thaiword thai-word-table (length thaiword) 0 t)))
+    (and (listp result)
+        (integerp (car result))
+        (= 1 (car result)))))
 
 (defun thai-word-table-save(filename &optional alist)
   "save thai words extracted from a nested-alist table to



Home | Main Index | Thread Index | Old Index