summaryrefslogtreecommitdiffabout
path: root/scm/verbop.scm
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 /scm/verbop.scm
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 (limited to 'scm/verbop.scm') (more/less context) (ignore whitespace changes)
-rw-r--r--scm/verbop.scm32
1 files changed, 21 insertions, 11 deletions
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)
- (set! conjugation
- (if conjugation
- (append conjugation (list (cons key val)))
- (list (cons 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 elt))
+ (list elt)))))
;;; Verb structure:
@@ -222,14 +230,16 @@ VALUES (~Q,~Q,~Q,~Q,~Q)"
(define (flush-mood mood vstr)
(if (eq? (car mood) #:root)
- (let ((val (cdr mood)))
- (ellinika:sql-query
- "INSERT INTO irregular_root (verb,voice,thema,root) \
+ (for-each
+ (lambda (val)
+ (ellinika:sql-query
+ "INSERT INTO irregular_root (verb,voice,thema,root) \
VALUES (~Q,~Q,~Q,~Q)"
- (verb-get #:verb)
- vstr
- (car val)
- (cdr val)))
+ (verb-get #:verb)
+ vstr
+ (car val)
+ (cdr val)))
+ (cdr mood))
(let ((mood-str (car mood)))
(let ((lst (cdr mood)))
(cond

Return to:

Send suggestions and report system problems to the System administrator.