O’zbekiston respublikasi oliy va o’rta maxsus ta’lim vazirligi buxoro davlat universiteti qo’lyozma huquqida udk
Download 1.04 Mb.
|
Buxoro davlat universiteti
- Bu sahifa navigatsiya:
- 2.2.2.4-chizma.
- 2.2.2.5-chizma.
English sinfi
Prologda English sinfini yasab olganimizdan keyin English Pro paketiga dasturimizni kiritamiz. Bu dasturni ko’rinishi quyidagicha: % Fayl english.pro implement english open core, semantic clauses %% classInfo("english", "1.0"). article(case(art, ""), ["the"]). noun(case(nom, "Welt"), ["world"]). noun(case(nom, "Fall"), ["case"]). noun(case(nom, "alles"), ["all"]). nounphr( world(T1, T2), list::append(A,N)) :- article(T1, A), noun(T2, N). nounphr( case(nom, "alles"), ["all"]). copula(world(case(cop, "ist"), T), list::append(["is"], R1)) :- nounphr(T, R1). phr(world(T1, T2), list::append(Start, S1)) :- nounphr(T1, Start), copula(T2, S1). end implement English Xuddi avvalgi bo’limda German sinfida gapirib o’tganimizdagidek English sinfiga ham keyingi dasturimizni kiritamiz. Bu dastur quyidagicha: % Fayl english.cl class english open core, semantic predicates classInfo : core::classInfo. article : (tree, string*) nondeterm (i,o)(o,o). noun : (tree, string*) nondeterm (i,o)(o,o). nounphr : (tree, string*) nondeterm (i,o)(o,o). copula : (tree, string*) nondeterm (o,o)(i, o). phr : (tree, string*) nondeterm (i,o). end class english Shu bilan English sinfiga ham dasturlarni kiritib bo’ldik. Endi esa bu dasturlarni ishlatib ko’ramiz. Bu uchun Prolog dasturida masalalar paneliga borib, Build tugmasini ustiga borib bosamiz. So’ngra shu oynadan Build tugmasini bosamiz. Bizni ekranimida quyidagicha oyna hosil bo’ladi. Bu oynadan Cancel tugmasini bosamiz. Bizni dasturlarimizda xatolik bo’lmasa xato chiqarmaydi. 2.2.2.4-chizma. Prologda xatolikni tekshirish Endi biz uchta yaratgan sinfimizni bir biriga bog’laymiz. Bu uchun biz Main sinfini yasab olamiz. Main sinfiga quyidagi dasturni kiritamiz. Project Name: tratactus UI Strategy: console implement main open core, console, semantic class predicates test:(). clauses classInfo("main", "tratactus"). test() :- german::phr(T, ["die", "Welt", "ist", "alles"], _X), write(T), nl, english::phr(T, Translation), !, write(Translation), nl. test(). run():- console::init(), test(). end implement main goal mainExe::run(main::run). Dasturimizni ishlatib ko’ramiz xatoligi bo’lmasa, bizga quyidagicha oyna hosil bo’ladi. 2.2.2.5-chizma.Ishlatilgan dastur natijasi. Prologda semantic dasturini ishga tushgandan so’ng natijasi Bu dasturlardan chiqaruv daraxti yasaymiz. World< World Yuqoridagilar Semantic proyektini natijasi. [“the”, “World”, “is”, “all”] [“die”, “Welt”, “ist”, “alles”] Download 1.04 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling