1 / 31

Lecture 3

Lecture 3. Semantic Networks. Semantic Networks. Introduced by Quillian (1966) for natural language processing.

diza
Download Presentation

Lecture 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 3 Semantic Networks

  2. Semantic Networks Introduced by Quillian (1966) for natural language processing. He was interested in creating a knowledge representation format that would allow the meaning or semantics of words to be represented, so these meanings could be used to perform tasks in a humanlike manner.

  3. Semantic Networks Semantic networks are widely used to represent physical and/or causal associations between various concepts or objects. Used as a tool by linguistics, as a representational language for natural language Investigated by psychologists: semantic nets as a model for human long term memory.

  4. Representing the knowledge about “semantic network” by a semantic network Reference: Yintang Dai, Shiyong Zhang, Jidong Chen, Tianyuan Chen, Wei Zhang, Semantic Network Language Generation based on a Semantic Networks Serialization Grammar, World Wide Web, September 2010, Volume 13, Issue 3, pp 307-341

  5. Content of item Beijing Reference: Yintang Dai, Shiyong Zhang, Jidong Chen, Tianyuan Chen, Wei Zhang, Semantic Network Language Generation based on a Semantic Networks Serialization Grammar, World Wide Web, September 2010, Volume 13, Issue 3, pp 307-341

  6. Semantic Networks 1. Representing facts & relationships - two types of factual knowledge about objects in a domain ATTRIBUTES of the objects & RELATIONSHIPS

  7. 2. Semantic network representation of knowledge • Facts about objects and their relationships can be represented • graphically in a semantic network • A graph made up ofnodesandarcs/linkswhere • the nodes represent objects, properties/attributes & values • the links represent attributes of objects or relationships between • labels for both nodes and arcs

  8. 3. Reasoning with semantic networks - Knowledge explicitly represented in a semantic network can be used to infer additional facts which are NOT explicitly represented (1)Inferencesmay rely on rules of common sense e.g., For all objects X, Y, and Z if X is on Y and Y is left of Z then X is left of Z in the example network cup-1 is on saucer-1 and saucer-1 is left of teapot-1 it follows the above general rule, then: cup-1 is left of teapot-1

  9. (2) Inferences based on transitivity - Relationship is a is transitive if X is a Y and Y is a Z then X is a Z holds for all distinct objects X, Y and Z - Relationship part of is transitive

  10. - Relationship supported by is transitive, allowing the inference shown by the dotted line in the following semantic network fragment - However, the relationship is on (i.e., resting directly on) is not transitive cup-1 is on saucer-1 and saucer-1 is on table-1 but cup-1 is not on table-1 - Relationships among people brother of is transitive but not father of

  11. (3) Inference based on inheritance - A node inherits information from its related more general node - Add a general object node, other nodes inherit its properties - Eases the task of coding knowledge - Automatically infer information about related objects in hierarchy Example: attribute purpose is inherited

  12. (4) Inferences based on transitivity and inheritance Two steps involved in the inference shown by the dotted line: Step 1. inference based on transitivity Step 2. inference based on inheritance

  13. (5) Dealing with exceptions - Inheritance is a default mechanism and exceptions do occur Wings Air HAS BREATHE Canary Bird Animal Tweety IS-A IS-A IS-A TRAVEL IS-A Fly Penguin From the above semantic network, it can be inferred that: Canary is a animal Tweety is a bird Tweety is a animal Penguin is a bird Penguin is a animal Penguin travel fly …...

  14. - If an attribute’s value is explicitly represented in a semantic net, it takes priority over the value that would otherwise by inherited Step 1. Account for exceptions on local basis Step 2. Link new node with information that over-ride the incorrectly inherited information Wings Air HAS BREATHE Canary Bird Animal Tweety IS-A IS-A IS-A TRAVEL IS-A Fly Penguin TRAVEL Walk

  15. Semantic Net Operation How do you travel? User Bird Fly TRAVEL Fly How do you travel? How do you travel? How do you travel? Bird Tweety Canary User Fly Fly Fly TRAVEL Fly

  16. (6) Multiple inheritance - If objects are allowed to have more than one parent, inheritance of conflicting attribute values must be prevented e.g., What is the purpose of 12 Hill Street - Methods of solving the conflict include giving priority to values inherited along the leftmost path Using this convention, a KBS would infer that the purpose of 12 Hill Street is -

  17. Advantages & Disadvantages Advantages Explicit and succinct Reduced search time Inheritance Has correspondence with human memory Disadvantages No interpretation standards Invalid inferences Combinatorial explosion: if a relation is false many or all of the relations in the network must be examined.

  18. Semantic Network Implementation with Prolog

  19. Known relationships between objects will be represented as Prolog facts: • isa(bird, animal). • isa(robin, bird). • isa(fish, animal). • isa(cod, fish). • isa(mammal, animal). • isa(lion, mammal). • isa(horse, mammal). • isa(bat, mammal). • isa(pipistrelle, bat).

  20. Other facts explicitly represented in the semantic network will be represented as AOV (attribute-object-value) triples: • fact(legs, bird, two). • fact(legs, mammal, four). • fact(legs, bat, two). Lists of known objects and attributes will be represented as Prolog facts: • objects([bird, animal, robin, bat, lion, pipistrelle, horse, mammal, cod,fish]). • attributes([legs]).

  21. Making isa transitive • In Prolog, the following simple rule would lead to problems with infinite recursion: • isa(X, Z) :- isa(X, Y), isa(Y, Z). • Instead, we need to define a predicate with a different name • isa1(X,Y) :- isa(X,Y). • isa1(X,Z) :- isa(X,Y), isa1(Y,Z).

  22. Making isa transitive • We can use isa1 to find all the things a given object is, or find objects of a given type ?- isa1(pipistrelle,O). O = bat; O = mammal; O = animal ?- isa1(O,mammal). O = lion; O = horse; O = bat; O = pipistrelle isa(bird, animal). isa(robin, bird). isa(fish, animal). isa(cod, fish). isa(mammal, animal). isa(lion, mammal). isa(horse, mammal). isa(bat, mammal). isa(pipistrelle, bat). • isa1(X,Y) :- isa(X,Y). • isa1(X,Z) :- isa(X,Y), isa1(Y,Z).

  23. Classifying a given object • The following predicate checks if a given object is at the top of the is a hierarchy treetop(O1) :- isa(O1,O2), !, fail. treetop(O1). • Using treetop, the following predicate creates a list of all the superclasses to which a given object belongs: classify(O,[]) :- treetop(O). classify(O1,[O2|L]):- isa(O1,O2), classify(O2,L).

  24. Classifying a given object ?- classify(pipistrelle, L). L = [bat, mammal, animal] ?- classify(animal, L). L = []

  25. Finding a common superclass to which two given objects belong The following predicate finds the first element, if any, that two given lists have in common firstcommon(L1,L2,X): - member(X, L1), member(X, L2), !. Given two objects, we can now use classify and firstcommon to find their nearest common ancestor sameclass(O1,O2,O3) :- classify(O1,L1), classify(O2,L2), firstcommon(L1,L2,O3). ?- sameclass(horse,lion,O). O = mammal ?- sameclass(cod,robin,O). O = animal

  26. Implementing inheritance • The following predicate will find the value of an attribute of a given object, using inheritance if necessary query(A,O,V) :- fact(A,O,V). query(A,O,V) :- attributes(As), member(A,As), objects(Os), member(O,Os), inherit(A,O,V). • fact(legs, bird, two). • fact(legs, mammal, four). • fact(legs, bat, two). • objects([bird, animal, robin, bat, lion, pipistrelle, horse, mammal, cod,fish]). • attributes([legs]).

  27. Implementing inheritance A value can be inherited only if there is no explicit value and must be the first available value inherit(A,O,V1) :- fact(A,O,V2), !, fail. inherit(A,O1,V1):- isa1(O1,O2), fact(A,O2,V2), !, V1 = V2. inherit(A,O,undefined). If there is no explicit value, and none can be inherited, then the value is undefined there is no explicit value the first available value

  28. Querying the semantic network • fact(legs, bird, two). • fact(legs, mammal, four). • fact(legs, bat, two). What is the value of an attribute for a given object? ?- query(legs, mammal, V). V = four ?- query(legs, pipistrelle, V). V = two ?- query(legs, cod, V). V = undefined Does any object have a given attribute value? ?- query(legs, O, two). O = bird; O = bat; O = robin; O = pipistrelle inherit(A,O,V1) :- fact(A,O,V2), !, fail. inherit(A,O1,V1):- isa1(O1,O2), fact(A,O2,V2), !, V1 = V2. inherit(A,O,undefined).

  29. Question • Write a predicate that finds common features of two given objects by comparing their values for each known attribute. • Write a prolog program that works for the above problem.

More Related