aboutsummaryrefslogtreecommitdiff
path: root/cgi-bin
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2004-03-30 12:04:08 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2004-03-30 12:04:08 +0000
commit75aaf43b7cb4349a61b91e6a93993dd2e92fb99e (patch)
tree2bf02758b70c961fbd11e34740b81499417ad673 /cgi-bin
parent95772e05a2f8248159c4fc0a640fa6cdaeb476ba (diff)
downloadellinika-75aaf43b7cb4349a61b91e6a93993dd2e92fb99e.tar.gz
ellinika-75aaf43b7cb4349a61b91e6a93993dd2e92fb99e.tar.bz2
(translate-kbd): Recognize \th, \ks
and \ps escapes. Translate 'th' to 'thita' when followed by a vocal. git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@66 941c8c0f-9102-463b-b60b-cd22ce0e6858
Diffstat (limited to 'cgi-bin')
-rw-r--r--cgi-bin/dict.cgi.in54
1 files changed, 46 insertions, 8 deletions
diff --git a/cgi-bin/dict.cgi.in b/cgi-bin/dict.cgi.in
index f0e2cfd..cfe2f64 100644
--- a/cgi-bin/dict.cgi.in
+++ b/cgi-bin/dict.cgi.in
@@ -313,8 +313,11 @@
(cons #\V "Ω")))
+(define (after-thita? c)
+ (member c (list #\a #\e #\i #\o #\y #\v)))
+
;;; Given input string in Greek transliteration, convert it to
-;;; an equivalent Greek work in UTF-8 encoding. The input string is
+;;; an equivalent Greek word in UTF-8 encoding. The input string is
;;; supposed to follow the traditional Greek keyboard layout:
;;;
;;; +----------------------------------------------------------------+
@@ -330,11 +333,20 @@
;;; | space bar |
;;; +-----------------------------+
;;;
+;;;
+;;; The followin escape sequences are recognized:
+;;;
+;;; '\ks' -> 'ξ'
+;;; '\ps' -> 'ψ'
+;;; '\th' -> 'θ'
+;;;
;;; Additionally some spell fixing heuristics is applied:
+;;;
;;; 's' at the end of the word -> 'ς'
;;; 'w' anywhere but at the end of the word -> 'ω'
;;; 'ks' -> 'ξ'
;;; 'ps' -> 'ψ'
+;;; "th" -> 'θ' unless followed by a consonant
;;; "u'" -> 'ύ'
;;;
;;; FIXME: The case of less obvious spelling errors, like e.g. 'ou' -> 'ου'
@@ -360,18 +372,44 @@
greek-kbd-map)))
(if g
(set! l (cons (cdr g) l))
- (set! l (cons (string (car sl)) l)))))))
+ (if (char=? (car sl) #\\)
+ (cond
+ ((> (length sl) 2)
+ (cond
+ ((char=? (car (cdr (cdr sl))) #\s)
+ (let ((c (car (cdr sl))))
+ (cond
+ ((char=? c #\k)
+ (set! sl (cdr (cdr sl)))
+ (set! l (cons "ξ" l)))
+ ((char=? c #\p)
+ (set! sl (cdr (cdr sl)))
+ (set! l (cons "ψ" l)))
+ (else
+ (set! sl (cdr sl))))))
+ ((and (char=? (car (cdr sl)))
+ (char=? (car (cdr (cdr sl))) #\h))
+ (set! sl (cdr (cdr sl)))
+ (set! l (cons "θ" l)))))
+
+ (else
+ (set! l (cons (string (car sl)) l))))))))))
(if (null? l)
(decode-kbd-map)
- (let ((cmap (assoc (car sl) greek-postfix-map)))
- (cond
- (cmap
+ (cond
+ ((char=? (car sl) #\h)
+ (if (and (not (null? (cdr sl)))
+ (after-thita? (car (cdr sl))))
+ (set-car! l "θ")
+ (decode-kbd-map)))
+ ((assoc (car sl) greek-postfix-map) =>
+ (lambda (cmap)
(let ((x (assoc (car l) (cdr cmap))))
(if x
(set-car! l (cdr x))
- (decode-kbd-map))))
- (else
- (decode-kbd-map)))))))))
+ (decode-kbd-map)))))
+ (else
+ (decode-kbd-map))))))))
;; Translate the input string to UTF-8 if necessary.

Return to:

Send suggestions and report system problems to the System administrator.