程序代写代做代考 algorithm database python 2021/1/23, 3:30 AM
2021/1/23, 3:30 AM
Artificial Intelligence Project, part 1
Updates made on Jan. 17 have a light blue background.
Below is part 1 of the quarter-long chatbot project. It is due at the end of the day, 11:59pm Pacific Time, on Monday, Jan. 25. Upload the following to Canvas, in the “Project Part 1” assignment:
All the source code files needed to run your code. It is likely that this means your revised versions of the three supplied .py files, but if you have additional files, or files in a different programming language, upload them.
A report, named Report.txt or Report.docx or Report.pdf. The contents of the report are described below. Feel free to include additional information that will help us understand your work and score your project correctly. If any parts of your work are buggy or incomplete, state that clearly. It’s much better for you to tell us about a problem than for us to find it.
You must work on the project individually. You can talk with other people in the class about your and their general approaches, but do not copy any code or algorithm details.
Python files (as .txt files):
Proj1.py CYKParse.py Tree.py
Text-based chatbots typically have several components:
Code to convert the input string into a parse tree. (CYKParse,
Page 1 of 3
2021/1/23, 3:30 AM
getSentenceParse)
Code to convert a parse tree into some convenient internal representation. (updateRequestInfo)
Code to retrieve information from a database, using the convenient internal representation. (getTemperature)
Code to format a reply to the user, based on the retrieved information. (reply)
You’ll notice that in the starter code most of these components are implemented in a rudimentary way. As you proceed through the project, you’ll need to design and code more robust and interesting replacements for the code supplied here.
Your assignment for part 1 of the project is to complete the following steps. You should get started soon, although it is likely that some details of the steps may change over the next week.
Steps
Become familiar with the supplied code, and translate it into another programming language if you choose. It would be good to run CYKParse as the main module, comment out and un-comment out various lines in the main() function, and carefully look at the output. Nothing to turn in for this step.
The CYK-Parse in the textbook (Fig. 23.5) and in the code require that the syntax be in Chomsky Normal Form. Sometimes this is inconvenient, and it would be helpful to also accept syntax rules of the form X ⟶ Y [p] — that is, with a single category on the right hand side. For instance, one of the rules in Fig. 23.4 has such a form. Let’s call the modified CNF, relaxed to also permit single category right hand sides, “Chomsky 171 Form”. Your assignment in this step is to modify the CYKParse implementation to accept C1F. Report: Describe your approach to this step, and an overview of the changes you made. Provide a listing of the code you modified.
Now that your code accepts C1F, take advantage of it. Modify the getGrammarWeather function to use C1F rules, with no change in functionality. This should make the new grammar somewhat more compact. Report: Describe your approach to this step, and an overview of the changes you made. Provide a listing of the revised getGrammarWeather function.
Here’s a bold claim: “The probabilities associated with CNF and C1F lexicons, as seen in Fig. 23.3, are completely unnecessary and have no effect on the
Page 2 of 3
2021/1/23, 3:30 AM
output of CYK-Parse.” Is this statement true or false? Support your position, ideally by reporting on an experiment with your code. Report: Do you agree with the claim, or not? Back up your position, ideally by reporting on an experiment you ran.
Improve and extend the weather-bot in several ways:
Include the cities Tustin and Pasadena, and the time yesterday, in the system’s capabilities. Report: Describe your approach to this step, and an overview of the changes you made. Provide a listing of the revised getGrammarWeather function.
Extend the grammar to understand and respond to questions of the sort “Will tomorrow be hotter than today in Irvine”, “Will yesterday be hotter than tomorrow in Pasadena?” (Yes, the verb tense doesn’t quite work in that one, but you can ignore that.) Report: Describe your approach to this step, and an overview of the changes you made. Provide listings of the code you changed or created.
Page 3 of 3