Question
Please use Python: You will design a simple chat bot that is used to help gardeners start their own gardens and get answers about the
Please use Python:
You will design a simple chat bot that is used to help gardeners start their own gardens and get answers about the most common problems a new gardener might face.
The first step in designing the chat bot KB is to understand the gardening domain, and identify its main attributes. The second step is to identify the logic symbols from these attributes, and the final step is to create the knowledge base to include all symbols and sentences. Finally, we can use propositional logic inference to check if the knowledge base entails certain facts.
Step 1: Understanding the Domain
A new gardener would need to learn some basics about soil, watering, planting times, pollination, fertilization and sunlight.
The general rule for gardening is:
if you plant at the right time, water regularly, expose plant to enough sun, and have good pollination, then you should expect a good yield.
There are also some common problems that a gardener could face, and they have easy fixes. We list some problems and their fixes below.
If the seeds are not germinating, then they need more watering.
If the plant is not blossoming, then it needs more fertilization.
If the flowers are not bearing fruits, then they need pollination.
If the leaves are yellow but not dry, then the plant is overwatered.
If the leaves are yellow and dry, then the plant is underwatered.
If the plant is growing slowly, then it needs more sunlight or more water.
Step 2: Defining the Logic Symbols
The first step in creating the KB is to define the Logic Symbols that represent the different parameters. These can be inferred from each of the tips listed in step 1.
For example, for the first tip:
"if you plant at the right time, water regularly, expose plant to enough sun, and have good pollination, then you should expect a good yield."
We can define the following Logic Symbols:
RightTimePlanting
RegularWatering
Sun
Pollination
ExpectedGoodYield
Another example is for the second tip:
"If the seeds are not germinating, then they need more watering"
Where we can define the following Logic Symbols:
GerminatingSeeds
NeedMoreWatering
Now, take the remaining tips and create Logic Symbols for them similar to the two examples shown above.
Step 3: Creating the Knowledge Base (KB)
After defining the logic symbols, it is now time to construct the whole KB. The KB will include all the logic symbols, plus any rules that are defined by the domain description listed in Step 1.
For example, for this tip:
"if you plant at the right time, water regularly, expose plant to enough sun, and have good pollination, then you should expect a good yield."
and now that we have defined the corresponding logic symbols: RightTimePlanting, RegularWatering, Sun, Pollination, and ExpectedGoodYield, now we can define a complex sentence using these symbols as follows:
RightTimePlanting RegularWatering Sun Pollination ExpectedGoodYield
Likewise, and for the second tip:
"If the seeds are not germinating, then they need more watering"
and using the logic symbols GerminatingSeeds and NeedMoreWatering, we can define this complex sentence:
GerminatingSeeds NeedMoreWatering
Now, write one complex sentence for each tip using the logic symbols you defined in Step 2.
Step 4: Propositional Inference on the KB
We will now use the KB to help a new gardener who is facing a problem with his garden. The gardener gives you this information:
The seeds have successfully germinated. (this means that Germinating = True)
The flowers are blossoming. (Blossoming = True)
The Plant is not bearing fruits. (Bearing Fruits = False)
The Plant has yellow, non-dry leaves. (This means that Yellow Dry Leaves = False, but Yellow Non Dry Leaves = True).
The plant is growing slowly. (SlowGrowth = True)
Now, what can we infer about plant watering? Namely, what can we infer about the values of the OverWatering and UnderWatering Logic Symbols? To find the answer, apply the propositional logic inference process. As explained in the lessons, create a truth table that holds the logic symbols and the rules. For simplicity, we will only focus on the logic symbols we know their values, and the two rules involved with OverWatering and UnderWatering. The table should look something like this:
Germinating | Blossoming | BearingFruits | YellowDry | YellowNonDry | SlowGrowth | OverWatering | UnderWatering | Rule 1 | Rule 2 |
True | True | False | False | True | True | True | True | ||
True | True | False | False | True | True | True | False | ||
True | True | False | False | True | True | False | True | ||
True | True | False | False | True | True | False | False |
Where Rule 1 and Rule 2 are the two rules that involve over and under watering.
Follow the inference process explained in the lessons and check if there are consistent values for OverWatering and UnderWatering that make both rules hold. If you find any such values, then this means that you can infer something about whether this gardener is over- or under-watering his/her plants. List the obtained results.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started