summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2011-06-20 14:06:59 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-06-20 14:06:59 (GMT)
commitb6bbb4f2cf0144aa58701cd2b46277838743a277 (patch) (side-by-side diff)
tree1e9bcd3bd7871f2d38ee804b8d803f85317c788b
parent554d5663361e1506a757e7639524ce4d461d043c (diff)
downloadellinika-b6bbb4f2cf0144aa58701cd2b46277838743a277.tar.gz
ellinika-b6bbb4f2cf0144aa58701cd2b46277838743a277.tar.bz2
Allow for alternative stems in a same tense.
* data/irregular-verbs.xml: Add alternative passive aorist stem for "lev". * scm/verbop.scm (conjugation-set): When setting #:root, keep a list of alternative stems. (flush-mood): Update for changes in #:root storage. * src/cgi-bin/conj.scm4 (show-best-matches): If only one match is produced, show it immediately. * src/ellinika/conjugator.scm: Allow for multiple stems. * src/ellinika/sql.scm (->string): Bugfix.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--data/irregular-verbs.xml1
-rw-r--r--scm/verbop.scm16
-rw-r--r--src/cgi-bin/conj.scm43
-rw-r--r--src/ellinika/conjugator.scm41
-rw-r--r--src/ellinika/sql.scm2
5 files changed, 48 insertions, 15 deletions
diff --git a/data/irregular-verbs.xml b/data/irregular-verbs.xml
index 2e604e3..1923d88 100644
--- a/data/irregular-verbs.xml
+++ b/data/irregular-verbs.xml
@@ -464,6 +464,7 @@
</act>
<pas>
<root theme="aor">ειπώθ</root>
+ <root theme="aor">λεχθ</root>
<ind>
<t name="Ενεστώτας">
<prop name="root">λέγ</prop>
diff --git a/scm/verbop.scm b/scm/verbop.scm
index 0fff38f..8308d70 100644
--- a/scm/verbop.scm
+++ b/scm/verbop.scm
@@ -130,10 +130,18 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (command-line))" "$@"
ret))
(define (conjugation-set key val)
+ (let ((elt (cond
+ ((not (eq? key #:root))
+ (cons key val))
+ ((and conjugation (assoc (car val) conjugation)) =>
+ (lambda (entry)
+ (set-cdr! entry (cons (cdr val) (cdr entry)))))
+ (else
+ (cons key (list val))))))
(set! conjugation
(if conjugation
- (append conjugation (list (cons key val)))
- (list (cons key val)))))
+ (append conjugation (list elt))
+ (list elt)))))
;;; Verb structure:
@@ -222,7 +230,8 @@ VALUES (~Q,~Q,~Q,~Q,~Q)"
(define (flush-mood mood vstr)
(if (eq? (car mood) #:root)
- (let ((val (cdr mood)))
+ (for-each
+ (lambda (val)
(ellinika:sql-query
"INSERT INTO irregular_root (verb,voice,thema,root) \
VALUES (~Q,~Q,~Q,~Q)"
@@ -230,6 +239,7 @@ VALUES (~Q,~Q,~Q,~Q)"
vstr
(car val)
(cdr val)))
+ (cdr mood))
(let ((mood-str (car mood)))
(let ((lst (cdr mood)))
(cond
diff --git a/src/cgi-bin/conj.scm4 b/src/cgi-bin/conj.scm4
index fec7eca..8c5e317 100644
--- a/src/cgi-bin/conj.scm4
+++ b/src/cgi-bin/conj.scm4
@@ -328,6 +328,8 @@ ifelse(IFACE,[CGI],(cgi:init))
(cond
((null? result)
(search-failure key))
+ ((= (length result) 1)
+ (show-conjugation (caar result)))
(else
(format #t
"<div class=\"error\"><p>~A</p></div>"
@@ -407,6 +409,7 @@ ifelse(IFACE,[CGI],(cgi:init))
(cgi:names))))
(cons "@@conj@@"
(lambda ()
+ (format #t "<!-- ~A -->" (environ))
(dict-connect)
(main-form)
(do-conj)
diff --git a/src/ellinika/conjugator.scm b/src/ellinika/conjugator.scm
index 0abec8d..f70e20c 100644
--- a/src/ellinika/conjugator.scm
+++ b/src/ellinika/conjugator.scm
@@ -47,7 +47,10 @@
((#:attested)
(list-set! verb 3 (append (list-ref verb 3) (list value))))
(else
- (let ((container (assoc key (list-ref verb 2))))
+ (let ((container (assoc key (list-ref verb 2)))
+ (value (if (and (eq? key #:root) (not (list? value)))
+ (list value)
+ value)))
(if container
(set-cdr! container value)
(list-set! verb 2 (append (list-ref verb 2)
@@ -101,8 +104,9 @@
"SELECT property,value FROM verbtense WHERE \
verb=\"~A\" AND voice=\"~A\" AND mood=\"~A\" AND tense=\"~A\""
verb voice mood tense)))
- (create-basic-verb-info verb
- (if (null? verbprop)
+ (create-basic-verb-info
+ verb
+ (let loop ((inlist (if (null? verbprop)
'()
(map
(lambda (elt)
@@ -114,8 +118,19 @@ verb=\"~A\" AND voice=\"~A\" AND mood=\"~A\" AND tense=\"~A\""
(cons (symbol->keyword
(string->symbol name))
value))))
- verbprop)))))
-
+ verbprop)))
+ (rootlist '())
+ (outlist '()))
+; (format #t "ARGS: ~A/~A/~A~%" inlist rootlist outlist)
+ (cond
+ ((null? inlist)
+ (if (null? rootlist)
+ outlist
+ (cons (cons #:root rootlist) outlist)))
+ ((eq? (caar inlist) #:root)
+ (loop (cdr inlist) (cons (cdar inlist) rootlist) outlist))
+ (else
+ (loop (cdr inlist) rootlist (cons (car inlist) outlist))))))))
(define (thema-aoristoy-mesapathitikis-A root)
(cond
@@ -192,7 +207,7 @@ WHERE verb=\"~A\" AND voice=\"~A\" AND thema=\"~A\""
(cond
((not (null? result))
(verb-set! vinfo #:attested 'root)
- (caar result))
+ (map car result))
((string=? (verb-get vinfo #:conj) "A")
(let ((root (verb-A-root elverb)))
(cond
@@ -357,10 +372,9 @@ AND c.tense=\"~A\" AND c.flect = f.ident ORDER by fold"
(conj-info #:accmap conj)
"000000"))))
-(define (apply-flect conj vinfo verb)
+(define (apply-flect conj vinfo verb root)
; (format #t "VINFO ~A~%" vinfo)
- (let ((root (verb-get vinfo #:root))
- (suffix (get-suffix conj vinfo))
+ (let ((suffix (get-suffix conj vinfo))
(accmap (string->list (get-accmap conj vinfo)))
(augment ""))
; (format #t "ROOT ~A, ACCMAP ~S, SUFFIX: ~A~%" root accmap suffix)
@@ -552,13 +566,18 @@ AND i.tense=\"~A\" AND i.ident=f.ident"
(car (cdr thema)))
(car thema))))
; (format #t "VINFO ~A~%" vinfo)
+
+ (fold
+ (lambda (stem prev)
(cons
(cons
- (append (apply-flect conj vinfo verb)
+ (append (apply-flect conj vinfo verb stem)
(list (verb-get vinfo #:conj)
(verb-get vinfo #:attested)))
(conj-info #:fold conj))
- prev)))))
+ prev))
+ prev
+ (verb-get vinfo #:root))))))
'()
conj-list))))))))
diff --git a/src/ellinika/sql.scm b/src/ellinika/sql.scm
index 5867d28..f281847 100644
--- a/src/ellinika/sql.scm
+++ b/src/ellinika/sql.scm
@@ -44,7 +44,7 @@
((string? arg) arg)
((elstr? arg) (elstr->string arg))
((number? arg) (number->string arg))
- ((bool? arg) (if arg "true" "false"))
+ ((boolean? arg) (if arg "true" "false"))
(else
(error "Unhandled argument type: ~S" arg))))

Return to:

Send suggestions and report system problems to the System administrator.