%% Karttunen's X -> L ... R. Every X is `bracketed' with L and R. macro(dots(X,L,R), [[free(X), [[] x L, X, [] x R]]*, free(X)]). %% Karttunen's A => L R. Every A must occur in context L _ R. macro(restrict(A,L,R), ~[? *,A,~[R,? *]] & ~[~[? *,L],A,? *]). macro(cons,{b,c,d,f,g,h,j,k,l,m,n,p,q,r,s,t,v,w,x,z}). macro(lbr,{'O[', 'D[', 'X[', 'N['}). macro(input,{cons,vowel}*). macro(parse, dots(cons,{'O[','D[','X['},']') o dots(vowel,{'N[','X['},']')). macro(overparse,[([] x [lbr,']'])^,dots({cons,vowel},[],[lbr,']']^)]). macro(onset,['O[', cons^, ']']). macro(nucleus,['N[', vowel^, ']']). macro(coda,['D[', cons^, ']']). macro(unparsed,['X[', {cons,vowel}, ']']). macro(syllable_structure,ignore([onset^,nucleus,coda^],unparsed)* ). macro(gen, input o overparse o parse o syllable_structure). macro(have_ons,restrict('N[', onset, [])). macro(nocoda,free('D[')). %% 'parse' is used twice in Karttunen 98; we use parsed(N) where N is %% the maximum number of occurrences of X macro(parsed(N), free(N,'X[')). macro(fillnuc, free(['N[', ']'])). macro(fillons, free(['O[', ']'])). :- op(403,yfx,lc). macro(R lc C, lenient_composition(R,C)). macro(syllabify,gen lc have_ons lc nocoda lc fillnuc lc parsed(0) lc parsed(1) lc parsed(2) lc parsed(3) lc parsed(4) lc fillons ).