Commit | Line | Data |
---|---|---|
504f06a2 EZ |
1 | ;;; thai-word.el -- find Thai word boundaries |
2 | ||
3 | ;; Copyright (C) 2000, 2001, 2002, 2003, 2004 | |
4 | ;; Electrotechnical Laboratory, JAPAN. | |
5 | ||
6 | ;; Author: Kenichi HANDA <handa@etl.go.jp> | |
7 | ||
8 | ;; Keywords: thai, word break, emacs | |
9 | ||
10 | ;; This program is free software; you can redistribute it and/or modify | |
11 | ;; it under the terms of the GNU General Public License as published by | |
12 | ;; the Free Software Foundation; either version 2, or (at your option) | |
13 | ;; any later version. | |
14 | ||
15 | ;; This program is distributed in the hope that it will be useful, | |
16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | ;; GNU General Public License for more details. | |
19 | ||
20 | ;; You should have received a copy of the GNU General Public License | |
21 | ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 | ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | ||
24 | ;; The used Thai word list has been taken from IBM's ICU4J project | |
25 | ;; (file `thai6.ucs', version 1.4, converted to TIS encoding, with | |
26 | ;; removal of three incorrect entries) to which the following license | |
27 | ;; applies: | |
28 | ;; | |
29 | ;; COPYRIGHT AND PERMISSION NOTICE | |
30 | ;; | |
31 | ;; | |
32 | ;; Copyright (c) 1995-2001 International Business Machines | |
33 | ;; Corporation and others | |
34 | ;; | |
35 | ;; All rights reserved. | |
36 | ;; | |
37 | ;; | |
38 | ;; Permission is hereby granted, free of charge, to any person | |
39 | ;; obtaining a copy of this software and associated documentation | |
40 | ;; files (the "Software"), to deal in the Software without | |
41 | ;; restriction, including without limitation the rights to use, | |
42 | ;; copy, modify, merge, publish, distribute, and/or sell copies of | |
43 | ;; the Software, and to permit persons to whom the Software is | |
44 | ;; furnished to do so, provided that the above copyright notice(s) | |
45 | ;; and this permission notice appear in all copies of the Software | |
46 | ;; and that both the above copyright notice(s) and this permission | |
47 | ;; notice appear in supporting documentation. | |
48 | ;; | |
49 | ;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
50 | ;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | |
51 | ;; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
52 | ;; NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE | |
53 | ;; COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE | |
54 | ;; FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, | |
55 | ;; OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR | |
56 | ;; PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER | |
57 | ;; TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | |
58 | ;; PERFORMANCE OF THIS SOFTWARE. | |
59 | ;; | |
60 | ;; Except as contained in this notice, the name of a copyright | |
61 | ;; holder shall not be used in advertising or otherwise to promote | |
62 | ;; the sale, use or other dealings in this Software without prior | |
63 | ;; written authorization of the copyright holder. | |
64 | ||
65 | ||
66 | ;; This file implements an algorithm to find Thai word breaks using a | |
67 | ;; dictionary. It is based on the C program `cttex' written by | |
68 | ;; Vuthichai Ampornaramveth <vuthi@nii.ac.jp>. | |
69 | ||
70 | ||
71 | ;; Table of Thai words. It is a nested alist (see `nested-alist-p'), | |
72 | ;; which means that you can easily index the list character by | |
73 | ;; character. | |
74 | ||
75 | (defconst thai-word-table nil) | |
76 | ||
77 | ||
78 | ;; Set up `thai-word-table'. | |
79 | ||
80 | (let | |
81 | ((l | |
82 |