Thanks Steve for the feedback. The testing for a word at the end of a sentence requires a comma to be present just before the last word so that statements such as “You are correct” will not be flagged a question. The custom web page codes commas as “XCOMMA” so they are not stripped out. I can choose to strip them out after determining if the users input is a question. The case of “Will” being a first name is challenging. I might let regular aiml pattern matching handle this case and any specific names and then reevaluate whether the input is a question, using a mixed approach as you suggest. Another approach might be to test the word following the word “Will” and determine if it is in a list of last names, but that seems less efficient.
I found this site listing question words:
http://www.hopstudios.com/nep/unvarnished/item/list_of_english_question_words
The author seems to distinguish between question words that can only be used as question words and words that can be used as verbs which they do not consider to be questions words. I am not sure but I do not think the distinction matters in the case of testing the first word of a sentence.
I have added “does” to the list. I have also added “which”, “whose”, “am”, “whom”, “has”, “have”, and the more archaic “wherefore”, “wherewith”, “wither” and “wence” just in case.
I think there are also commands that might be used to demand a response such as “Riddle me this ...” and “Tell me if..” and I think these are best handled with regular aiml pattern matching.
Originally, I was after the functionality of Chatscript where some patterns are only checked if the input is determined to be a question and others only if the input is determined to be a statement. After further consideration and research it might be best if I created 100+ question patterns in AIML and then flagged the user input as a question if the question pattern is matched. Would it be more efficient if the pattern matching of questions could be split out from pattern matching for statements?
(∞Pla•Net Thanks for the links. Not really sure what to make of them. The site just repeats my questions with the phrase “asked” appended. It is used to build up data as to what people consider to be questions or statements?)
How do people handle questions like “Tomorrow, will you be online?” versus “Will you be online tomorrow?” Would you have to handle every different word order case in AIML as separate patterns? The method I am using now would not work if there was a preceding adverb or prepositional phrase before the actual question. Would I have to test for “will you”, “will he”, “will she”, “will they” separately in the middle of a users input? What about “Will the president…”, “Will Bob…”, etc. ?