TAILIEUCHUNG - learn prolog now phần 8

Quy tắc DCG thực sự các quy tắc Prolog thông thường trong ngụy trang, và điều này có nghĩa rằng bạn phải chú ý những gì thông dịch viên Prolog của bạn với dụ cuối cùng của chúng tôi, chúng ta sẽ xác định một DCG cho ngôn ngữ chính thức một tỷ. Ngôn ngữ này là gì? Và một ngôn ngữ chính thức là gì? | 122 Chapter 8. More Definite Clause Grammars Exercises Exercise Here s our basic DCG. s -- np vp. np -- det n. vp -- v np. vp -- v. det -- the . det -- a . n -- woman . n -- man . v -- shoots . Suppose we add the noun men which is plural and the verb shoot . Then we would want a DCG which says that The men shoot is ok The man shoots is ok The men shoots is not ok and The man shoot is not ok. Change the DCG so that it correctly handles these sentences. Use an extra argument to cope with the singular plural distinction. Exercise Translate the following DCG rule into the form Prolog uses kanga V R Q -- roo V R jumps Q Q marsupial V R Q . Practical Session 8 The purpose of Practical Session 8 is to help you get familiar with DCGs that make use of additional arguments and tests. First some keyboard exercises 1. Trace some examples using the DCG which uses extra arguments to handle the subject object distinct the DCG which produces parses and the DCG which uses extra tests to separate lexicon and rules. Make sure you fully understand the way all three DCGs work. 2. Carry out traces on the DCG for dnbncn that was given in the text that is the DCG that gave the Count variable the values 0 succ 0 succ succ 0 and so on . Try cases where the three blocks of as bs and cs are indeed of the same length as well as queries where this is not the case. Now for some programming. We suggest two exercises. . Practical Session 8 123 1. First bring together all the things we have learned about DCGs for English into one DCG. In particular today we say how to use extra arguments to deal with the subject object distinction and in the exercises you were asked to use additional arguments to deal with the singular plural distinction. Write a DCG which handles both. Moreover write the DCG in such a way that it will produce parse trees and makes use of a separate lexicon. 2. Once you have done this extend the DCG so that noun phrases can be modified by adjectives and simple .

TỪ KHÓA LIÊN QUAN
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.