![]() ![]() Monkey can move from one place to another using walk or move clauses.Īnother predicate will be canget(). The push or drag operation moves the block from one place to another. on top state), by performing the action climb. has not state), then using the grasp action, it will change from has not state to have state.įrom the floor, it can move to the top of the block (i.e. When the block is at the middle, and monkey is on top of the block, and monkey does not have the banana (i.e. We have some predicates that will move from one state to another state, by performing action. We will create some predicates as follows − Now, let us see how we can solve this using Prolog. When the monkey is on the block, and block is at the center, then the monkey can get the bananas. So the vertical position of the monkey will be changed. If monkey and the block both are on the floor, and block is at the center, then the monkey can climb up on the block. If the block position is not at the center, then monkey can drag it to the center. From the above image, we can see that both the monkey and the block are on the floor. Monkey can reach the block, if both of them are at the same level. Below are few observations in this case − So if the monkey is clever enough, he can come to the block, drag the block to the center, climb on it, and get the banana. The monkey wants the banana, but cannot reach it. There is a block (or chair) present in the room near the window. Problem StatementĪ hungry monkey is in a room, and he is near the door.īananas have been hung from the center of the ceiling of the room. B, C) must start in upper case and that the sentence has to be simple, meaning that the program is not able to process for instance a sentence like “the block B is on the table, while the block C is red and is on the block B”.In this prolog example, we will see one very interesting and famous problem, The Monkey and Banana Problem. The only constraint is that proper nouns (e.g. The program is able to process lots of sentences, provided that they are correct in the domain of interest. Once the Planner has performed the needed actions, the user is informed of the new situation. Instead when a command is requested by the user, it is transformed into a goal to reach and the execution of the Planner is required through PySWIP in order to reach this goal. When an assertion is entered by the user, the program uses PySWIP in order to add new identified facts to the SWI-Prolog knowledge base, while when a query is entered, always using PySWIP the program forwards the correct equivalent query to SWI-Prolog interpreter, so it can answer correctly according to the current knowledge base. The use of this library was necessary due to the decision of use Prolog in order to implement the Planner Algorithm. All those actions have been implemented using another Python library, namely PySWIP, a Python - SWI-Prolog bridge enabling to query SWI-Prolog in Python programs. Instead in case of a command it has to run the planner algorithm in order to reach the required goal. In case of an assertion, the program has to add facts from it to the knowledge base, according to the Planner Algorithm, while in case of a query it has to answer it according to the knowledge base. Therefore it can act differently according to the cases. ![]() ![]() Once obtained the tagged tree structure of the entered sentence, the program explores it in order to understand what the user wants. Once the user has entered the sentence, the program takes, tokenizes and transforms it in a part-of- speech tagged tree structure. This library allows to build Python programs which work with human language data, providing text processing for classification, tokenization, tagging and parsing. Indeed the program uses a Python library for NLP, namely Natural Language Toolkit (NLTK). In order to recognize the type of sentence the program uses the Natural Language Processing (NLP), a branch of AI that helps computers understand, interpret and manipulate human language. Once entered a sentence, the program recognize what kind it is and react accordingly to the result. Using the program the user has only to type sentences (reasonables in the domain of interest) that can be assertions, queries or commands. The goal of this project was to implement a program that allows users to solve the blocks world problem interacting only using the natural language. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |