Parsing Akkadian Verbs in Prolog Aaron Macks Brandeis University 7/11/02 ACL-02 Overview • Akkadian • Prolog • Parsing using Prolog • Java and web interface • Examples 7/11/02 ACL-02
Download ReportTranscript Parsing Akkadian Verbs in Prolog Aaron Macks Brandeis University 7/11/02 ACL-02 Overview • Akkadian • Prolog • Parsing using Prolog • Java and web interface • Examples 7/11/02 ACL-02
Parsing Akkadian Verbs in Prolog Aaron Macks Brandeis University 7/11/02 ACL-02 1 Overview • Akkadian • Prolog • Parsing using Prolog • Java and web interface • Examples 7/11/02 ACL-02 2 Akkadian • Verbal system based on three radicals, R1-R2R3, commonly from the verb paräsum: P-RS(to divide) • Any one or more radical can be ‘weak’ from letters in the earlier Proto-Semitic which dropped out or a soundless Aleph(’), i.e. elûm ’-L-weak 7/11/02 ACL-02 3 Verbs in Akkadian • Description of a conjugated verb has six parts – – – – – – Stem: P-R-S Stem type: G, D, N, $, Xt, Xn, Xtn Person: 1st, 2nd, 3rd Gender: M, F or common Number: Singular or plural Tense: Preterite, durative, perfect, imperfect, precative or vetitive • Ex: iprus -> PRS, 3CS, G-Preterite iqabbû-ma -> QB`, 3MP, G-Durative 7/11/02 ACL-02 4 Overview • Akkadian • Prolog • Parsing using Prolog • Java and web interface • Examples 7/11/02 ACL-02 5 Prolog Introduction • Logical programming language, emerged in the 1970’s, ISO standard in 1996 • Modern implementations can accept: • • • • – Declarations: father(X,Y) :- male(X),parent(X,Y). – DCG(definite clause grammar) rules: s(X,Y) --> [c]. s(X,Y) --> X, s(X,Y), Y. s --> s([a],[b]). 7/11/02 ACL-02 6 DCGs Continued • s([a,a,a,c,b,b,b],[]). – yes • s([a,a,a,c,b,b,b,d,d], T). – T = [d, d] • s([a,a,a,c,b,b|N],T). – N = [b|_G293] T = _G293 • s([n,i],[e], O, []). – O = [c] ; – O = [n, i, c, e] ; – O = [n, i, n, i, c, e, e] 7/11/02 ACL-02 7 Overview • Akkadian • Prolog • Parsing using Prolog • Java and web interface • Examples 7/11/02 ACL-02 8 Program Flow ?- verb(A,B,C,Type,[i,p,r,u,s]). • Prolog call to parse iprus, with A,B, and C bound to the stem and Type a string of the verb type • verb calls: G, D, N, G-suffix, D-suffix, Nsuffix • Each of G, D, and N call: preterite, perfect, durative, imperfect, vetitive, and precative • Each of the tenses call: strong, first-weak, secondweak, and third-weak. Some also have A, E, N, or W classes as well. 7/11/02 ACL-02 9 Sample ?- verb(A,B,C, Type, [ii,p,u,s],[]). verb(Ca, Cb, Cc, ['G'|Type], Verb) :- [gstem],g(Ca, Cb, Cc, Type, Verb, []). g(Ca, Cb, Cc, ['Preterite'|Type], Verb, Suff) :gpret(Ca, Cb, Cc, Type, Verb, Suff). gpret(Ca, Cb, Cc, [‘First Aleph’|Type], Verb, Suff) :fstwgpret(Ca, Cb, Cc, Verb, Suff, Type). fstweakgpred([@], Cb, Cc, [3, c, s]) --> [ii], Cb, vs, Cc. • A = @ B = p C = s Type = ['G', 'Preterite', 'First Aleph', 3, c, s] 7/11/02 ACL-02 10 Rule Count • The body of the parser consists of 601 DCG rules: – – – – 21 Vowel rules 4 String-to-PlNF 47 Suffix Remaining 529 in the stem definitions: •239 - G-Stem •193 - D-Stem •93 - N-Stem 7/11/02 ACL-02 11 DCG Rules • Simple: – fstweakgpred([@], Cb, Cc, [3, c, [ii], Cb, vs, Cc. s]) --> • Derivative – fstweakgpred([@], Cb, Cc, [2, f, s])--> fstweakgpred([w], Cb, Cc, [2, m, s]), [ii]. • Complex – ndur([Ca], Cb, Cc, ['Third Weak'|Type], Verb, Suff) :-trdwgdur([Ca,Ca], Cb, Cc, Type, Verb, Suff). 7/11/02 ACL-02 12 Overview • Akkadian • Prolog • Parsing using Prolog • Java and web interface • Examples 7/11/02 ACL-02 13 Flow • Web forms send data to parseAkk class • parseAkk reformats data, sends to akkadian class, executes Prolog code 7/11/02 ACL-02 14 Extra Java Features • * expansion for parsing 7/11/02 ACL-02 15 More Java Features • ‘Any’ keyword for generation • Problems: – Generates all possible vowel variations – Adds the -ma suffix – Can create large files [prs, Any] 7/11/02 ACL-02 16 Overview • Akkadian • Prolog • Parsing using Prolog • Java and web interface • Examples 7/11/02 ACL-02 17 Parsing Examples ?- verb(A,B,C,T, [i,p,r,u,s]). A B C T = = = = p r s ['G', 'Preterite', 3, c, s] ; ?- verb(p,r,s,[‘G’,’Preterite’, 2,c,p],Plnf). Plnf Plnf Plnf Plnf = = = = [t, [t, [t, [t, a, a, a, a, p, p, p, p, r, r, r, r, a, e, i, u, s, s, s, s, aa] aa] aa] aa] ; ; ; ; ?- verb(p,r,s,[S,’Preterite’, 2,c,p],Plnf). 7/11/02 ACL-02 18 Examples 2 • Stem = 'G' P = [i, p, • Stem = 'G' P = [i, p, • Stem = 'G' P = [i, p, • Stem = 'G' P = [i, p, • Stem = 'D' P = [u, p, i, s] ; 7/11/02 r, a, s] ; r, e, s] ; r, i, s] ; r, u, s] ; a, r, r, • Stem = 'N’ P = [i, p, i, s] ; • Stem = 'N' P = [i, p, i, s] ; • Stem = 'N' P = [i, p, i, s] ; • Stem = 'N' P = [i, p, i, s] ; ACL-02 p, a, r, p, e, r, p, i, r, p, u, r, 19 Suffix Examples • imhur$inaati – G Preterite 3 c s Accusative 3 f p • iddin$inaa$im – – – – – – 7/11/02 d-d-n--G Preterite 3 c s Dative 3 f p n-d-n--G Preterite First N 3 c s Dative 3 f p @-d-n--G Durative First Aleph 3 c s Dative 3 f p w-d-n--G Durative First W Stative 3 c s Dative 3 f p n-d-n--G Precative First N 3 c s Dative 3 f p @-d-n--D Imperative First Weak 2 m s Davie 3 f p ACL-02 20 Web Examples 7/11/02 ACL-02 21