Contoh Mengubah Knowledge Base Bahasa Alami ke First Order Logic (FOL)


Berikut di bawah ini adalah contoh-contoh daftar knowledge base dalam bentuk bahasa alami (bahasa manusia). Knowledge base tersebut akan diubah menjadi knowledge base dalam bentuk first order logic (FOL).

Contoh 1:

Di bawah ini adalah daftar kalimat dalam bahasa alami (dalam hal ini menggunakan bahasa inggris), kemudian diubah ke bahasa logika (dalam hal ini first order logic / FOL). 
Bahasa alami:
  1. Chandra is a student 
  2. Chandra is a student in computer science 
  3. Each computer science student is member of school of computer 
  4. Algorithm is difficult 
  5. Each student in computer science likes or hates the algorithm 
  6. Each student likes one lesson 
  7. The student which do not come to in difficult lessons, they do not like these lesson 
  8. Chandra does not come in algorithm 
First Order Logic (FOL):

daftar konstanta (constants): Chandra, algorithm, computer_science, school_of_computer)
daftar predikat (predicates):student(x), member(x,y), difficult(x), like(x,y), hate(x,y), come(x,y)
  1. Student (Chandra)
  2. Student (Chandra, computer_science)
  3. "x : student(x) Ù computer_science(x) Þ member (x, school_of_computer)
  4. Difficult(Algorithm)
  5. "x : student(x, computer_science) Þ like(x, Algorithm) Ú hate(x, Algorithm)
  6. "x $y : like(x, y)
  7. ""y : student(x) Ù difficult(y) Ù Øcome(x, y) Þ  Ølike(x, y)
  8. Øcome(Chandra, Algorithm) 

Contoh 2:

Bahasa alami:
  1. Marcus is a person. 
  2. Marcus is a Pompeian. 
  3. All Pompeians are Roman. 
  4. Caesar is a ruler. 
  5. All Romans are either loyal to Caesar or hate Caesar. 
  6. Everyone is loyal to someone. 
  7. People only try to assassinate rulers to whom they are not loyal. 
  8. Marcus tried to assassinate Caesar. 

First Order Logic (FOL):

Daftar konstanta (constants): Marcus, Caesar 
Daftar predikat (predicates): People(x), Pompeian(x), Roman(x), Ruler(x), Loyal(x,y), Hate(x,y), Assassinate(x,y) 
  1. People(Marcus) 
  2. Pompeian(Marcus) 
  3. ꓯxPompeian(x) → Roman(x) 
  4. Ruler(Caesar) 
  5. ꓯx Roman(x) → [Loyal(x, Caesar) ꓦ Hate(x, Caesar)] 
  6. ꓯxꓱyLoyal(x, y) 
  7. ꓯxꓯy(People(x) Ʌ Ruler(y) Ʌ Assassinate(x, y)) → ¬Loyal(x, y) 
  8. Assassinate(Marcus; Caesar)

No comments:

Post a Comment