1 / 10

Unification algorithm

Unification algorithm. We have seen examples of the use of unification. Now we will see, in detail, one way to implement a unification algorithm which implements structure sharing. A data structure to support unification.

trudy
Download Presentation

Unification algorithm

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. Unification algorithm • We have seen examples of the use of unification. • Now we will see, in detail, one way to implement a unification algorithm which implements structure sharing

  2. A data structure to support unification • We need a special data structure to allow structure sharing during unification: • each feature structure is represented using two components, a content component and a pointer component. • the representation forms a Directed Acyclic Graph (DAG)

  3. CONTENT POINTER Example 1 • The DAG representation for a simple feature structure: [Number SG, Person 3] • Expand first to: [Content [Number [Content SG, Pointer NULL], Person [Content 3, Pointer NULL]], Pointer NULL] SG CONTENT NULL NUMBER POINTER PERSON CONTENT 3 POINTER NULL NULL

  4. CONTENT POINTER Example 2 • The DAG representation for a simple feature structure: [Number SG] SG CONTENT NULL NUMBER POINTER NULL

  5. CONTENT POINTER Example 3 • The DAG representation for a simple feature structure: [Person 3] 3 CONTENT NULL PERSON POINTER NULL

  6. Algorithm (pg. 423 of text) function Unify(f1, f2) returns fs or failure f1.real  real contents of f1, *(f1.ptr) if ptr != null f2.real  real contents of f2, *(f2.ptr) if ptr != null if (f1.real is null) { f1.ptr  f2; return f2 } else if (f2.real is null) { f2.ptr  f1; return f1 } else if (f1.real == f2.real) {f1.ptr  f2; return f2 } else if (f1.real is complex and f2.real is complex) { f2.ptr  f1 foreach ftr2 in f2.real { ftr1  find/create feature ftr2 in f1.real if Unify(ftr2.value,ftr1.value) fails {return failure} return f1 else return failure

  7. CONTENT CONTENT POINTER POINTER Example 4, initial state • [Number SG]  [Person 3] SG CONTENT NULL NUMBER POINTER f1: NULL CONTENT 3 PERSON POINTER NULL f2: NULL

  8. Example 4, part 2 • [Number SG]  [Person 3] (note sharing!) SG CONTENT NULL NUMBER POINTER CONTENT POINTER NULL CONTENT 3 PERSON POINTER POINTER NULL CONTENT

  9. Example 4, part 3 • [Number SG]  [Person 3] (note sharing!) SG CONTENT NULL NUMBER POINTER CONTENT PERSON CONTENT NULL POINTER POINTER NULL CONTENT 3 PERSON POINTER POINTER NULL CONTENT

  10. Another example? • We can work through example on page 424 of text if you’d like.

More Related