summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2011-06-11 10:45:35 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2011-06-11 10:45:35 (GMT)
commit169d0e2887a40e4d845efcaa1e46ec49d02421b7 (patch) (side-by-side diff)
treec15cbf4bd8b94bd86b4da7253acd1a43e96f57e0
parenta1a5b7ddd6c3c0532c37551b24fd573a554ac181 (diff)
downloadellinika-169d0e2887a40e4d845efcaa1e46ec49d02421b7.tar.gz
ellinika-169d0e2887a40e4d845efcaa1e46ec49d02421b7.tar.bz2
Fixes in conjugator
* data/dbverb.struct: Expand conj to char(32). Fix several bugs in conjugation table. Introduce a new pseudo-conjugation A-depon, for verba deponentia. * data/irregular-verbs.xml: Update. * scm/conjugator.scm (complement-verb-info): Handle A-depon. (apply-flect): Don't try to set accent outside of a word, even if so required by accmap. (conjugate): For synthetic tenses, look up for aoristoy ypotaktikis of the same voice as the requested tense. Use accmap to decide whether a particular person exists in that tense. Fixes in syllabificator. * src/ellinika/elmorph.c (_elstr_set_accent): Fix setting accents on diphthongs. (deftab) <elmorph:iota>: New flag. * src/ellinika/elmorph.h (CHF_IOTA): New flag. * src/ellinika/syllabificator.c (SYL_FLAG_MASK): Add more bits. (next_syllable): Mark syllables with iota with CHF_DIPHTHONG|CHF_IOTA.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--data/dbverb.struct44
-rw-r--r--data/irregular-verbs.xml18
-rw-r--r--scm/conjugator.scm61
-rw-r--r--src/ellinika/elmorph.c18
-rw-r--r--src/ellinika/elmorph.h1
-rw-r--r--src/ellinika/syllabificator.c4
6 files changed, 111 insertions, 35 deletions
diff --git a/data/dbverb.struct b/data/dbverb.struct
index d51633b..f4a4b33 100644
--- a/data/dbverb.struct
+++ b/data/dbverb.struct
@@ -30,7 +30,7 @@ CREATE TABLE verbflect(
DROP TABLE IF EXISTS conjugation;
CREATE TABLE conjugation(
- conj char(2), -- REL 9
+ conj char(32), -- REL 9
voice enum('act','pas'), -- Ενεργητηκή/Μεσοπαθητική
mood enum('ind','sub','imp'),
tense varchar(128),
@@ -48,7 +48,7 @@ CREATE TABLE conjugation(
DROP TABLE IF EXISTS participle;
CREATE TABLE participle (
- conj char(2), -- REL 9
+ conj char(32), -- REL 9
voice enum('act','pas'), -- Ενεργητηκή/Μεσοπαθητική
tense char(32),
thema enum('pres','aor','sub'), -- Ενεστώτα, Αόριστου, υποτακτικής
@@ -109,7 +109,7 @@ INSERT INTO conjugation VALUES
("A", "act", "sub", "Παρακείμενος", 'synt', NULL, 0, NULL, "να", "έχω", "Ενεστώτας"),
-- Προστακτική
("A", "act", "imp", "Ενεστώτας", 'pres', NULL, 8, "-3--3-", NULL, NULL, NULL),
-("A", "act", "imp", "Αόριστος", 'sub', NULL, 9, "-0--0-", NULL, NULL, NULL),
+("A", "act", "imp", "Αόριστος", 'sub', NULL, 9, "-3--0-", NULL, NULL, NULL),
("A", "act", "imp", "Παρακείμενος", 'synt', NULL, 0, NULL, "να", "έχω", "Ενεστώτας"),
-- Μεσοπαθητική φωνή
-- Οριστική
@@ -120,16 +120,16 @@ INSERT INTO conjugation VALUES
("A", "pas", "ind", "Παρακείμενος", 'synt', NULL, 0, NULL, NULL, "έχω", "Ενεστώτας"),
("A", "pas", "ind", "Υπερσυντέλικος", 'synt', NULL, 0, NULL, NULL, "έχω", "Παρατατικός"),
("A", "pas", "ind", "Συντελεσμένος μέλλοντας", 'synt', NULL, 0, NULL, "θα", "έχω", "Ενεστώτας"),
-("A", "pas", "ind", "Μέλλοντας στιγμιαίος", 'aor', NULL, 15, "111111", "θα", NULL, NULL),
+("A", "pas", "ind", "Μέλλοντας στιγμιαίος", 'aor', NULL, 15, "ffffff", "θα", NULL, NULL),
-- Υποτακτική
("A", "pas", "sub", "Ενεστώτας", 'pres', NULL, 11, "333333", "να", NULL, NULL),
-("A", "pas", "sub", "Αόριστος", 'sub', NULL, 15, "111221", "να", NULL, NULL),
-("A", "pas", "sub", "Παρακείμενος", 'synt', NULL, 0, NULL, "να", "έχω", "Παρατατικός"),
+("A", "pas", "sub", "Αόριστος", 'sub', NULL, 15, "ffffff", "να", NULL, NULL),
+("A", "pas", "sub", "Παρακείμενος", 'synt', NULL, 0, NULL, "να", "έχω", "Ενεστώτας"),
-- Προστακτική
("A", "pas", "imp", "Ενεστώτας", 'pres', NULL, 11, "-3--3-", "να", NULL, NULL),
("A", "pas", "imp", "Αόριστος", 'aor', NULL, 17, "-0----", NULL, NULL, NULL),
("A", "pas", "imp", "Αόριστος", 'aor', NULL, 18, "----2-", NULL, NULL, NULL),
-("A", "pas", "imp", "Παρακείμενος", 'synt', NULL, 0, NULL, "να", "έχω", "Παρατατικός"),
+("A", "pas", "imp", "Παρακείμενος", 'synt', NULL, 0, "-0--0-", "να", "έχω", "Παρατατικός"),
-- Συζυγία Β΄ - α΄ τάξη
-- Ενεργητηκή φωνή
-- Οριστική
@@ -191,8 +191,8 @@ INSERT INTO conjugation VALUES
("B2", "act", "imp", "Αόριστος", 'aor', "ησ", 9, "-3--3-", NULL, NULL, NULL),
("B2", "act", "imp", "Παρακείμενος", 'synt', NULL, 0, NULL, "να", "έχω", "Ενεστώτας"),
--- Μεσοπαθητική φωνή
--- Οριστική
+-- Μεσοπαθητική φωνή
+-- Οριστική
("B2", "pas", "ind", "Ενεστώτας", 'pres', NULL, 34, "ffffff", NULL, NULL, NULL),
("B2", "pas", "ind", "Παρατατικός", 'pres', NULL, 35, "ffffff", NULL, NULL, NULL),
("B2", "pas", "ind", "Μέλλοντας διαρκείας", 'pres', NULL, 34, "ffffff", "θα", NULL, NULL),
@@ -211,7 +211,29 @@ INSERT INTO conjugation VALUES
("B2", "pas", "imp", "Αόριστος", 'aor', NULL, 31, "-2----", NULL, NULL, NULL),
("B2", "pas", "imp", "Αόριστος", 'aor', NULL, 32, "----2-", NULL, NULL, NULL),
-("B2", "pas", "imp", "Παρακείμενος", 'synt', NULL, 0, NULL, "να", "έχω", "Παρατατικός");
+("B2", "pas", "imp", "Παρακείμενος", 'synt', NULL, 0, NULL, "να", "έχω", "Παρατατικός"),
+-- Αποθετικά ρήματα
+("A-depon", "act", "sub", "Αόριστος", 'sub', NULL, 1, "000000", "να", NULL, NULL),
+-- Μεσοπαθητική φωνή
+-- Οριστική
+("A-depon", "pas", "ind", "Ενεστώτας", 'pres', NULL, 11, "000300", NULL, NULL, NULL),
+("A-depon", "pas", "ind", "Παρατατικός", 'pres', NULL, 12, "222333", NULL, NULL, NULL),
+("A-depon", "pas", "ind", "Μέλλοντας διαρκείας", 'pres', NULL, 11, "333333", "θα", NULL, NULL),
+("A-depon", "pas", "ind", "Αόριστος", 'aor', NULL, 2, "000000", NULL, NULL, NULL),
+("A-depon", "pas", "ind", "Παρακείμενος", 'synt', NULL, 0, NULL, NULL, "έχω", "Ενεστώτας"),
+("A-depon", "pas", "ind", "Υπερσυντέλικος", 'synt', NULL, 0, NULL, NULL, "έχω", "Παρατατικός"),
+("A-depon", "pas", "ind", "Συντελεσμένος μέλλοντας", 'synt', NULL, 0, NULL, "θα", "έχω", "Ενεστώτας"),
+("A-depon", "pas", "ind", "Μέλλοντας στιγμιαίος", 'sub', NULL, 15, "000000", "θα", NULL, NULL),
+-- Υποτακτική
+("A-depon", "pas", "sub", "Ενεστώτας", 'pres', NULL, 11, "333333", "να", NULL, NULL),
+("A-depon", "pas", "sub", "Αόριστος", 'sub', NULL, 1, "000000", "να", NULL, NULL),
+("A-depon", "pas", "sub", "Παρακείμενος", 'synt', NULL, 0, NULL, "να", "έχω", "Ενεστώτας"),
+-- Προστακτική -- FIXME
+("A-depon", "pas", "imp", "Ενεστώτας", 'pres', NULL, 11, "-3--3-", "να", NULL, NULL),
+("A-depon", "pas", "imp", "Αόριστος", 'aor', NULL, 17, "-0----", NULL, NULL, NULL),
+("A-depon", "pas", "imp", "Αόριστος", 'aor', NULL, 18, "----2-", NULL, NULL, NULL),
+("A-depon", "pas", "imp", "Παρακείμενος", 'synt', NULL, 0, NULL, "να", "έχω", "Παρατατικός")
+;
INSERT INTO participle VALUES
-- Συζυγία Α'
@@ -236,7 +258,7 @@ INSERT INTO participle VALUES
DROP TABLE IF EXISTS verb;
CREATE TABLE verb(
verb varchar(128), -- REL 10
- conj char(2), -- REL 9
+ conj char(32), -- REL 9
augment char(1),
accmap char(7),
suffix_aor_path varchar(2),
diff --git a/data/irregular-verbs.xml b/data/irregular-verbs.xml
index d056f7d..697b2cd 100644
--- a/data/irregular-verbs.xml
+++ b/data/irregular-verbs.xml
@@ -295,7 +295,7 @@
<root theme="aor">δωσ</root>
</act>
</v>
-
+<!--
<v>
<a>έρχομαι</a>
<c>A</c>
@@ -320,7 +320,21 @@
<root theme="sub">ερθ</root>
</pas>
</v>
-
+-->
+
+ <v>
+ <a>έρχομαι</a>
+ <c>A-depon</c>
+ <act>
+ <root theme="aor">έρθ</root>
+ </act>
+ <pas>
+ <root theme="aor">ήρθ</root>
+ <root theme="sub">ερθ</root>
+ </pas>
+ </v>
+
+
<!-- FIXME
έρχομαι
κάθομαι
diff --git a/scm/conjugator.scm b/scm/conjugator.scm
index c2c2171..7783d3a 100644
--- a/scm/conjugator.scm
+++ b/scm/conjugator.scm
@@ -1,6 +1,7 @@
(use-modules (ellinika elmorph)
(ellinika i18n)
(ellinika cgi)
+ (ellinika tenses)
(xmltools dict)
(gamma sql))
@@ -170,6 +171,16 @@ WHERE verb='" verb "' AND voice='" voice "' AND thema='" thema "'")))
(thema-aoristoy-mesapathitikis root)))
(else
#f))))
+ ((string=? (verb-info #:conj vinfo) "A-depon")
+ (let ((root (verb-A-root elverb)))
+ (cond
+ ((string=? thema "pres")
+ (verb-info-set! #:attested vinfo 'root)
+ root)
+ ((or (string=? thema "aor") (string=? thema "sub"))
+ #f) ; FIXME
+ (else
+ #f))))
((string=? (verb-info #:conj vinfo) "B1")
(let ((root (if (elstr-suffix? elverb "άω")
(elstr-trim elverb -2)
@@ -295,6 +306,7 @@ WHERE c.conj='" conj "' AND c.voice='" voice "' AND c.mood='" mood
(+ (- len syl) 1))))
(define (apply-flect conj vinfo verb)
+; (format #t "VINFO ~A~%" vinfo)
(let ((root (verb-info #:root vinfo))
(suffix (let ((s (conj-info #:suffix conj)))
(if s
@@ -344,12 +356,17 @@ WHERE c.conj='" conj "' AND c.voice='" voice "' AND c.mood='" mood
#f)
((char-numeric? acc)
(let ((num (- (char->integer acc) (char->integer #\0))))
- (let ((obj (elstr-append root suffix flect)))
+ (let ((obj (elstr-append
+ root suffix flect)))
(if (and augment (= (+ (elstr-number-of-syllables obj) 1)
num))
(set! obj (elstr-append augment obj)))
- (elstr-set-accent! obj num)
- obj)))
+ (let ((nsyl (elstr-number-of-syllables obj)))
+ (elstr-set-accent! obj (cond
+ ((< num nsyl) num)
+ ((< nsyl 3) nsyl)
+ (else 3)))
+ obj))))
(else
(error "invalid accent character" acc))))
(conj-info #:flect conj)
@@ -392,7 +409,7 @@ WHERE i.verb='" verb "' AND i.voice='" voice "' AND i.mood='" mood
(conj-info-set! #:particle conj #f))
(cond
((string=? (conj-info #:thema conj) "synt")
- (let* ((verb-conj (conjugate verb "act" "sub" "Αόριστος" #:nopart))
+ (let* ((verb-conj (conjugate verb voice "sub" "Αόριστος" #:nopart))
(form (list-ref verb-conj 2))
(part (conj-info #:particle conj)))
(cond
@@ -400,13 +417,18 @@ WHERE i.verb='" verb "' AND i.voice='" voice "' AND i.mood='" mood
; (format #t "FORM ~A FROM ~A~%" form verb-conj);;FIXME
(append
(map
- (lambda (aux)
- (elstr->string
- (if part
- (elstr-append part " " aux " " form)
- (elstr-append aux " " form))))
+ (lambda (aux flag)
+ (if (char=? flag #\-)
+ #f
+ (elstr->string
+ (if part
+ (elstr-append part " " aux " " form)
+ (elstr-append aux " " form)))))
(conjugation:table (conjugate (conj-info #:aux conj) "act" "ind"
- (conj-info #:auxtense conj))))
+ (conj-info #:auxtense conj)))
+ (string->list (or (verb-info #:accmap vinfo)
+ (conj-info #:accmap conj)
+ "000000")))
(list (verb-info #:conj vinfo)
(conjugation:attested verb-conj))))
(else
@@ -485,6 +507,17 @@ WHERE i.verb='" verb "' AND i.voice='" voice "' AND i.mood='" mood
(newline)
(gc))
+(define (test-voice voice verb)
+ (for-each
+ (lambda (mood-tenses)
+ (let ((mood (car mood-tenses)))
+ (for-each
+ (lambda (tense)
+ (test-conjugation verb voice mood tense))
+ (cdr mood-tenses))))
+ ellinika-tense-list))
+
+;(test-conjugation "διαβάζω" "act" "imp" "Αόριστος")
;; (test-conjugation "είμαι" "act" "ind" "Ενεστώτας")
;; (test-conjugation "είμαι" "act" "ind" "Παρατατίκος")
;; (test-conjugation "είμαι" "act" "ind" "Μέλλοντας διαρκείας")
@@ -546,12 +579,14 @@ WHERE i.verb='" verb "' AND i.voice='" voice "' AND i.mood='" mood
;; (test-conjugation "πίνω" "act" "sub" "Αόριστος")
;; (test-conjugation "πίνω" "act" "imp" "Αόριστος")
-(test-conjugation "έρχομαι" "pas" "ind" "Παρατατικός")
-(test-conjugation "έρχομαι" "pas" "ind" "Αόριστος")
-(test-conjugation "έρχομαι" "pas" "sub" "Αόριστος")
+;(test-conjugation "έρχομαι" "pas" "ind" "Παρατατικός")
+;(test-conjugation "έρχομαι" "pas" "ind" "Αόριστος")
+;(test-conjugation "έρχομαι" "pas" "sub" "Αόριστος")
;; (test-conjugation "έρχομαι" "pas" "ind" "Συντελεσμένος Μέλλοντας")
;; (test-conjugation "έρχομαι" "act" "sub" "Αόριστος" )
;; (test-conjugation "έρχομαι" "pas" "sub" "Αόριστος" )
;; (test-conjugation "έρχομαι" "pas" "ind" "Ενεστώτας");FIXME!
;; (test-conjugation "έρχομαι" "pas" "ind" "Υπερσυντέλικος")
+
+(test-voice "pas" "ντύνω")
(newline)
diff --git a/src/ellinika/elmorph.c b/src/ellinika/elmorph.c
index 5a8acdf..6d6a69a 100644
--- a/src/ellinika/elmorph.c
+++ b/src/ellinika/elmorph.c
@@ -595,17 +595,13 @@ _elstr_set_accent(SCM el, SCM n, int destructive, const char *func_name)
start = elstr->sylmap[acc_num].phoneme_start;
pos = 0;
- for (i = 0; i < elstr->sylmap[acc_num].phoneme_count; i++) {
- struct phoneme *ph = elstr->phoneme + start + i;
+
+ for (i = elstr->sylmap[acc_num].phoneme_count; i > 0; i--) {
+ struct phoneme *ph = elstr->phoneme + start + i - 1;
if (ph->flags & CHF_CONSONANT)
/* skip */ ;
- else if (ph->flags & CHF_DIPHTHONG) {
- phoneme = ph;
- pos = ph->start + 1;
- break;
- } else if (ph->flags & CHF_VOWEL) {
+ else if (ph->flags & CHF_VOWEL) {
phoneme = ph;
- pos = ph->start;
break;
}
}
@@ -614,6 +610,11 @@ _elstr_set_accent(SCM el, SCM n, int destructive, const char *func_name)
"cannot set accent on syllable #~S of ~S: "
"INTERNAL ERROR",
scm_list_2(n, el));
+ else if (phoneme->flags & CHF_DIPHTHONG)
+ pos = phoneme->start + phoneme->count - 1;
+ else
+ pos = phoneme->start;
+
phoneme->flags |= CHF_OXEIA;
elstr->sylmap[acc_num].flags |= CHF_OXEIA;
elstr->str[pos] = elchr_accent(elstr->str[pos], CHF_OXEIA);
@@ -743,6 +744,7 @@ static struct deftab {
{ CHF_UPPER, "elmorph:upper" },
{ CHF_NUMERIC, "elmorph:numeric" },
{ CHF_DIPHTHONG, "elmorph:diphthong" },
+ { CHF_IOTA, "elmorph:iota" },
};
SCM_DEFINE_PUBLIC(scm_elstr_char_phoneme, "elstr-char-phoneme",
diff --git a/src/ellinika/elmorph.h b/src/ellinika/elmorph.h
index 2399b8a..c0df60f 100644
--- a/src/ellinika/elmorph.h
+++ b/src/ellinika/elmorph.h
@@ -34,6 +34,7 @@
#define CHF_NUMERIC 0x04000
#define CHF_DIPHTHONG 0x08000
+#define CHF_IOTA 0x10000
/* Phonemes */
#define PHON_A 1 /* α */
diff --git a/src/ellinika/syllabificator.c b/src/ellinika/syllabificator.c
index c4105ec..e034163 100644
--- a/src/ellinika/syllabificator.c
+++ b/src/ellinika/syllabificator.c
@@ -32,7 +32,7 @@ struct syllabificator {
int err;
};
-#define SYL_FLAG_MASK (CHF_ACCENT_MASK)
+#define SYL_FLAG_MASK (CHF_ACCENT_MASK|CHF_DIPHTHONG|CHF_IOTA)
#define ISIOTA(ph) \
((ph).code == PHON_I && (ph).count == 1 && \
@@ -94,6 +94,8 @@ next_syllable(struct syllabificator *sp)
syl->char_count += sp->phon[sp->phon_cur].count;
syl->phoneme_count++;
sp->phon_cur++;
+ if (sp->phon[sp->phon_cur].flags & CHF_VOWEL)
+ syl->flags |= CHF_DIPHTHONG|CHF_IOTA;
}
if (sp->phon[sp->phon_cur].flags & CHF_VOWEL)

Return to:

Send suggestions and report system problems to the System administrator.