Quixote,
Your detection strings need a little tweaking.
Now is:
If InStr(1, TestSentence, " TURN TO TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, " TURN TO CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT CHANNEL ", 1) > 0 Then
Should be:
InStr(1, TestSentence, "TURN TO TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "TURN TO CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT CHANNEL ", 1) > 0 Then
Notice that "TURN TO TELEVISION CHANNEL " and "TURN TO CHANNEL " strings should not have leading spaces. The prior line to detection is this:
TestSentence = Trim(HalBrain.AlphaNumericalOnly(UserSentence)) 'Get rid of punctuation and end spaces.
This is what is happening:
UserSentence = " SELECT TELEVISION CHANNEL 123 " <-- before Trim()
TestSentence = "SELECT TELEVISION CHANNEL 123" <-- after Trim()
Incorrect:
Detection String = " SELECT TELEVISION CHANNEL "
Correct:
Detection String = "SELECT TELEVISION CHANNEL "
When it comes to string detection you have to certain what the strings look like after processing. Spaces are as important as characters.
I didn't find any other errors in the code. I can't speak for the girder code though.
=vonsmith=