German sinfi
Biz avvalo Semantic sinfga quyidagi dastuni kiritamiz.
class semantic
open core
domains
category = art; nom; cop; rel.
tree = case(category, string); world(tree, tree); silence.
predicates
classInfo : core::classInfo.
end class semantic
Bu yerda 2ta gap haqida so’z yuritiladi.
Ingliz tilida “The World is all”
Nemis tilida “Die Welt ist alles”
Ikkala so’zni ham ma’nosi “Dunyo hammaniki” deyilgan. Prologda German sinfini yasab olganimizdan keyin German Pro paketiga dasturimizni kiritamiz. Bu dasturni ko’rinishi quyidagicha:
% Fayl german.pro
implement german
open core, semantic
clauses
classInfo("german", "1.0").
article(case(art, ""), ["die"|Rest], Rest).
article(case(art, ""), ["der"|Rest], Rest).
noun(case(nom, "Welt"), ["Welt"|R], R).
noun(case(nom, "Fall"), ["Fall"|R], R).
copula(world(case(cop, "ist"), T), ["ist"|R1], R) :-
nounphr(T, R1, R).
nounphr(world(T1, T2), Start, End) :-
article(T1, Start, S1), noun(T2, S1, End).
nounphr(case(nom, "alles"), ["alles"|R], R).
phr(world(T1, T2), Start, End) :-
nounphr(T1, Start, S1), copula(T2, S1, End).
end implement german
Bu dasturni kiritganimizdan so’ng bizga yangi dastur kerak bo’ladi. Bu dasturlardan chiqaruv daraxti yasaymiz. Keyingi dasturimizni Fayl german.cl ga kiritamiz. Bu dastur quyidagicha:
% Fayl german.cl
class german
open core, semantic
predicates
classInfo : core::classInfo.
article : (tree, string*, string*) nondeterm (o, i, o).
noun : (tree, string*, string*) nondeterm (o, i, o).
nounphr : (tree, string*, string*) nondeterm (o, i, o).
copula : (tree, string*, string*) nondeterm (o, i, o).
phr : (tree, string*, string*) nondeterm (o, i, o).
end class german
Biz German sinfiga dasturlarni kiritib bo’ldik.
|