aboutsummaryrefslogtreecommitdiff
path: root/scm
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-06-05 14:30:35 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2011-06-05 14:30:35 +0300
commit00131c263a9cb0ff8501bc1c4dc1e38b84af1a88 (patch)
treefac7ae1890927d77335518f4d65498375c163bbb /scm
parentdaca71a486490125471d0fb8d596d004485179bf (diff)
downloadellinika-00131c263a9cb0ff8501bc1c4dc1e38b84af1a88.tar.gz
ellinika-00131c263a9cb0ff8501bc1c4dc1e38b84af1a88.tar.bz2
Introduce support for individual verbs.
Diffstat (limited to 'scm')
-rw-r--r--scm/conjugator.scm70
1 files changed, 45 insertions, 25 deletions
diff --git a/scm/conjugator.scm b/scm/conjugator.scm
index 3015b13..99f5189 100644
--- a/scm/conjugator.scm
+++ b/scm/conjugator.scm
@@ -220,31 +220,48 @@ WHERE c.conj='" conj "' AND c.voice='" voice "' AND c.mode='" mode
forms)
forms))))
+(define (individual-verb verb voice mode tense)
+ (let ((res (my-sql-query
+ (dict-connect)
+ (string-append
+ "SELECT f.sing1,f.sing2,f.sing3,f.plur1,f.plur2,f.plur3 \
+FROM individual_verb i,verbflect f \
+WHERE i.verb='" verb "' AND i.voice='" voice "' AND i.mode='" mode
+"' AND i.tense = '" tense "' AND i.ident=f.ident"))))
+ (if (not (null? res))
+ (car res)
+ #f)))
+
(define (conjugate verb voice mode tense . rest)
- (let* ((vinfo (get-verb-info verb))
- (conj (get-conj-info (verb-info #:conj vinfo) voice mode tense)))
- (if (not conj)
- (error "cannot obtain conjugation information for "
- (verb-info #:conj vinfo) voice mode tense))
- (if (member #:nopart rest)
- (list-set! conj 3 #f))
- (cond
- ((string=? (conj-info #:thema conj) "synt")
- (let ((form (list-ref
- (conjugate verb "act" "sub" "Αόριστος" #:nopart) 2))
- (part (conj-info #:particle conj)))
- (map
- (lambda (aux)
- (elstr->string
- (if part
- (elstr-append part " " aux " " form)
- (elstr-append aux " " form))))
- (conjugate (conj-info #:aux conj) "act" "ind"
- (conj-info #:auxtense conj))) ))
- (else
-; (format #t "CONJ ~S~%" conj)
- (complement-verb-info vinfo verb voice (conj-info #:thema conj))
- (apply-flect conj vinfo)))))
+ (cond
+ ((individual-verb verb voice mode tense) =>
+ (lambda (res)
+ res))
+ (else
+ (let* ((vinfo (get-verb-info verb))
+ (conj (get-conj-info (verb-info #:conj vinfo) voice mode tense)))
+ (if (not conj)
+ (error "cannot obtain conjugation information for "
+ (verb-info #:conj vinfo) voice mode tense))
+ (if (member #:nopart rest)
+ (list-set! conj 3 #f))
+ (cond
+ ((string=? (conj-info #:thema conj) "synt")
+ (let ((form (list-ref
+ (conjugate verb "act" "sub" "Αόριστος" #:nopart) 2))
+ (part (conj-info #:particle conj)))
+ (map
+ (lambda (aux)
+ (elstr->string
+ (if part
+ (elstr-append part " " aux " " form)
+ (elstr-append aux " " form))))
+ (conjugate (conj-info #:aux conj) "act" "ind"
+ (conj-info #:auxtense conj))) ))
+ (else
+ ; (format #t "CONJ ~S~%" conj)
+ (complement-verb-info vinfo verb voice (conj-info #:thema conj))
+ (apply-flect conj vinfo)))))))
;;
;(display (verb-info "βρίσκω"))
@@ -257,7 +274,10 @@ WHERE c.conj='" conj "' AND c.voice='" voice "' AND c.mode='" mode
(display (map force-string (conjugate verb voice mode tense)))
(newline)
(gc))
-
+
+(test-conjugation "είμαι" "act" "ind" "Ενεστώτας")
+(test-conjugation "είμαι" "act" "ind" "Παρατατίκος")
+(test-conjugation "είμαι" "act" "ind" "Μέλλοντας διαρκείας")
(test-conjugation "έχω" "act" "ind" "Ενεστώτας")
(test-conjugation "ανοίγω" "act" "ind" "Ενεστώτας")
(test-conjugation "ανοίγω" "act" "ind" "Αόριστος")

Return to:

Send suggestions and report system problems to the System administrator.