Detecting Whole Words for JAVA -
Currently with the program, if the user uses "cat" then the ketobot will spit back " Tell me more about. "As was thought. However it is also true if letter cat is part of another word. Then the catch holder will be picked up as a catch and Chebbot will come back "tell me more about my pet." How do I go and know how to go to the keyword?
If (statement.indexOf ("cat")> = 0) {response = "tell me more about my pet.";
Certain ways to improve keyword detection:
- Create a list / set
- Use the split ("") function on your string to get only the words (this gives a string [] from which you can loop) < / Ul>
Comments
Post a Comment