diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-05 14:30:35 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-06-05 14:30:35 +0300 |
commit | 00131c263a9cb0ff8501bc1c4dc1e38b84af1a88 (patch) | |
tree | fac7ae1890927d77335518f4d65498375c163bbb | |
parent | daca71a486490125471d0fb8d596d004485179bf (diff) | |
download | ellinika-00131c263a9cb0ff8501bc1c4dc1e38b84af1a88.tar.gz ellinika-00131c263a9cb0ff8501bc1c4dc1e38b84af1a88.tar.bz2 |
Introduce support for individual verbs.
-rw-r--r-- | data/db.struct | 20 | ||||
-rw-r--r-- | scm/conjugator.scm | 70 |
2 files changed, 64 insertions, 26 deletions
diff --git a/data/db.struct b/data/db.struct index c5c20af..616d2c5 100644 --- a/data/db.struct +++ b/data/db.struct @@ -160,6 +160,7 @@ CREATE TABLE newsart( ---- +set names utf8; DROP TABLE IF EXISTS verbflect; CREATE TABLE verbflect( ident int(32) not null, -- REL 8 @@ -225,7 +226,10 @@ INSERT INTO verbflect VALUES (33, NULL, "είς", NULL, NULL, "είτε", NULL), (34, "ούμαι", "είσαι", "είται", "ούμαστε", "είστε", "ούνται"), (35, "ούμουν", "ούσουν", "ούvταν", "ούμαστε", "ούσαστε", "ούνταν"), -(36, NULL, "είσαι", NULL, NULL, "είστε", NULL); +(36, NULL, "είσαι", NULL, NULL, "είστε", NULL), +(100, "είμαι", "είσαι", "είναι", "είμαστε", "είστε,είσαστε", "είναι"), +(101, "ήμουν(α)", "ήσουν(α)", "ήταν(ε)", "ήμαστε,ήμασταν", "ήσαστε,ήσασταν", "ήταν(ε)") +; INSERT INTO conjugation VALUES @@ -403,3 +407,17 @@ INSERT INTO irregular_root VALUES ('έχω','act', 'aor', 'είχ') ; +DROP TABLE IF EXISTS individual_verb; +CREATE TABLE individual_verb( + verb varchar(128), + voice enum('act','pas'), -- Ενεργητηκή/Μεσοπαθητική + mode enum('ind','sub','imp'), + tense varchar(128), + ident int(32), + INDEX(verb,voice,mode,tense) +); + +INSERT INTO individual_verb VALUES +("είμαι", "act", "ind", "Ενεστώτας", 100), +("είμαι", "act", "ind", "Παρατατικός", 101) +; 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" "Αόριστος") |