Parsing Akkadian Verbs in Prolog
description
Transcript of Parsing Akkadian Verbs in Prolog
7/11/02 ACL-02 1
Parsing Akkadian Verbs in Prolog
Aaron MacksBrandeis University
7/11/02 ACL-02 2
Overview
• Akkadian• Prolog• Parsing using Prolog• Java and web interface• Examples
7/11/02 ACL-02 3
Akkadian
• Verbal system based on three radicals, R1-R2-R3, commonly from the verb paräsum: P-R-S(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 4
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-Preteriteiqabbû-ma -> QB`, 3MP, G-Durative
7/11/02 ACL-02 5
Overview
• Akkadian• Prolog• Parsing using Prolog• Java and web interface• Examples
7/11/02 ACL-02 6
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 7
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 8
Overview
• Akkadian• Prolog• Parsing using Prolog• Java and web interface• Examples
7/11/02 ACL-02 9
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, N-suffix
• Each of G, D, and N call: preterite, perfect, durative, imperfect, vetitive, and precative
• Each of the tenses call: strong, first-weak, second-weak, and third-weak. Some also have A, E, N, or W classes as well.
7/11/02 ACL-02 10
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 11
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 12
DCG Rules
• Simple:– fstweakgpred([@], Cb, Cc, [3, c, s]) --> [ii], Cb, vs, Cc.
• 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 13
Overview
• Akkadian• Prolog• Parsing using Prolog• Java and web interface• Examples
7/11/02 ACL-02 14
Flow
• Web forms send data to parseAkk class
• parseAkk reformats data, sends to akkadian class, executes Prolog code
7/11/02 ACL-02 15
Extra Java Features
• * expansion for parsing
7/11/02 ACL-02 16
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 17
Overview
• Akkadian• Prolog• Parsing using Prolog• Java and web interface• Examples
7/11/02 ACL-02 18
Parsing Examples
?- verb(A,B,C,T, [i,p,r,u,s]).A = pB = rC = sT = ['G', 'Preterite', 3, c, s] ;
?- verb(p,r,s,[‘G’,’Preterite’, 2,c,p],Plnf).Plnf = [t, a, p, r, a, s, aa] ;Plnf = [t, a, p, r, e, s, aa] ;Plnf = [t, a, p, r, i, s, aa] ;Plnf = [t, a, p, r, u, s, aa] ;
?- verb(p,r,s,[S,’Preterite’, 2,c,p],Plnf).
7/11/02 ACL-02 19
Examples 2
• Stem = 'G'
P = [i, p, r, a, s] ;• Stem = 'G'
P = [i, p, r, e, s] ;• Stem = 'G'
P = [i, p, r, i, s] ;• Stem = 'G'
P = [i, p, r, u, s] ;• Stem = 'D'
P = [u, p, a, r, r, i, s] ;
• Stem = 'N’P = [i, p, p, a, r, i, s] ;
• Stem = 'N'P = [i, p, p, e, r, i, s] ;
• Stem = 'N'P = [i, p, p, i, r, i, s] ;
• Stem = 'N'P = [i, p, p, u, r, i, s] ;
7/11/02 ACL-02 20
Suffix Examples
• imhur$inaati– G Preterite 3 c s Accusative 3 f p
• iddin$inaa$im– 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
7/11/02 ACL-02 21
Web Examples