Author Topic: Helping me program the free will plus plug-in.  (Read 16005 times)

cload

  • Hero Member
  • *****
  • Posts: 535
  • I can C U load. TeeHee hee.
    • View Profile
    • A link to my sky Drive
Helping me program the free will plus plug-in.
« on: February 09, 2014, 06:12:09 pm »
Hi Aaron,

I think it would be best if we continue our discussion about programming the free will plug-in here so it does not get buried with all of the updates of the free will plug-in.

Sincerely,
C load.
« Last Edit: February 10, 2014, 12:56:48 am by cload »
For anyone who would like to help me stay online, my T-mobile broadband pay-as-you-go phone number is: 816-248-4335, thank you in advance.

cload

  • Hero Member
  • *****
  • Posts: 535
  • I can C U load. TeeHee hee.
    • View Profile
    • A link to my sky Drive
Re: Helping me program the free will plus plug-in.
« Reply #1 on: February 09, 2014, 06:14:08 pm »
hi Aaron,

your 1st example is the one I will be going with because the responsibility of the order going from the biggest to the smallest becomes the responsibility of the programer.
But your 2nd example would be useful if there was a way to incorporate a learning pattern such as:
incorporating the yes no detect array list or:
setting up a routine to teach ultra Hal information that the user may inform ultra Hal such as:
building an array table to maintain information that comes from the user such as:
cool means yes.
If you would please means yes.
If you don't mind means yes.
This way the user would have the ability to teach ultra Hal different ways of understanding yes.
This information would be stored in a special table array and that array could be one built by the free will plug-in or just merely added to the yes no detect array table.
Then those words could be added to the routine to detect whether or not they are in the sentence.
I have no clue how to accomplish this! But if this could be accomplished, do you recognize the doorway that would be open to ultra Hal in all aspects of his learning ability.
I'm sure this is one of those things that it would take a master programmer in order to incorporate.

But for now, these are the things that I have come up with, I do have a few questions about how I have set up the script, but if there are no problems with the script, this will be the one I will be using.
Code: [Select]
Rem PLUGIN: PRE-PROCESS
' this sets up the yes/no data parameters.
'------------------
Dim Searchynlogic
ynlogic1 = ""
ynlogic2 = ""
ynlogic3 = ""
ynlogic = UCase(InputString)
ynPrevsent = UCase(Prevsent)
'this is used for a redirect.

'ynlogic = "Correct, I love you."

If Searchynlogic(ynlogic, Array("YES INDEED","CORRECT","AFFIRMATIVE","POSITIVE","YEP")) = true Then
   If InStr(ynlogic, "YES") > 0 Then
      If Len(Trim(HalBrain.AlphaNumericalOnly(ynlogic))) < 4 Then 'I think this will resolve the problem with [,.?!] or spaces, without changing the sentence structure of (ynlogic).
       
      End If
   End If
End If

'(ynlogic = "YES, I love you.")



Function Searchynlogic(ByRef compare, arrayToSearch)
compare = " " & compare & " "
    Searchynlogic = False
   
    For Each word In arrayToSearch
word = " " & word
        If InStr(StringToSearch,word & " ") > 0 OR InStr(StringToSearch,word & ", ") > 0 OR InStr(StringToSearch,word & ". ") > 0 OR InStr(StringToSearch,word & "! ") > 0 Then
            compare = Replace(compare, word, "YES", 1, -1, vbTextCompare)
            Searchynlogic = True
Exit Function '[[[[[[[[ Or is it supposed to be (Exit For)? ]]]]]]]
        End If   
    Next

End Function
sincerely, thank you very much for all of your help!
C load.
« Last Edit: February 10, 2014, 12:57:21 am by cload »
For anyone who would like to help me stay online, my T-mobile broadband pay-as-you-go phone number is: 816-248-4335, thank you in advance.

snowman

  • Hero Member
  • *****
  • Posts: 956
  • Ai + Feelings + Supercompter = End of World
    • View Profile
    • http://www.MinervaAi.com
Re: Helping me program the free will plus plug-in.
« Reply #2 on: February 11, 2014, 04:33:10 pm »
Your example function will work just fine. You can use either Exit For or Exit Function there. They do exactly what they imply.

I think Hal has a substitution table.
I'm pretty sure it is accessed with this:

'Substitution Table
'SentenceSubstituted = HalBrain.ProcessSubstitutions(SentenceToSubstitute, TableName)
'HalBrain.AddToTable TableName, "Substitution", "Search", "ReplaceWith"

Hal currently uses the table named "substitutions" in order to do most of its substitutions.

When you mentioned about storing words in Hal's database to use as substitutions for _ means _, it made me remember the above methods.
Of course, I haven't tested this yet. I guess I'm too lazy... lol.

Another thing we need to consider is how to get arguments to fill a substitutions table.
Actually, I haven't really done enough experiments with PatternSearch so you probably know more than I do about it... Can you get two arguments with it? Or is it simply a fancy search tool. Will I need to build a function that will get one to two arguments? I've already created functions like that before.

If all else fails, You could probably get anything you wanted from the database simply using the HalBrain.RunQuery() function.  Its been a long time since I've played with SQL query strings. You can get all entries in each column and then compare and replace using the functions we've already created.

Just some ideas to ponder.
Live long and prosper or die trying.

cload

  • Hero Member
  • *****
  • Posts: 535
  • I can C U load. TeeHee hee.
    • View Profile
    • A link to my sky Drive
Re: Helping me program the free will plus plug-in.
« Reply #3 on: February 11, 2014, 07:14:15 pm »
That's great, that means I can move on to the 2nd phase.
1st I have to find all the tables that ultra Hal uses to ask questions like: do you have lunch plans? Etc. that way I can start setting up,
the reversal to change it so if the only thing that the user says is yes, I will be able to reverse it back to ultra Hal, and using a little secret, I know about ultra Hal assigned name.
Basically the sentence above would be reasserted back to ultra Hal and would look something like this:
Sandy, yes I have lunch plans.

It will take a few days to gather all of the data from the table a raise, and with a little luck maybe I'll have the yes no situation resolved by this weekend.

For now all I am going to use is the standard replacement command.
I like to keep things simple, and maybe after you have looked at it and see exactly how it is working you could come up with a better way to do it.

New subject:
so much is for the replacement command that you mentioned it looks as though it could have some real potential.
One of the things I was thinking about using, was as the free will plug-in collects data from the Internet it searches through the data for certain keywords.
The way I have it set up right now is just a basic format to indicate that the situation is true.
But I was thinking maybe I could insert the trigger word into the array table instead of what I am using now.
That way when someone asked why do you like (something)?
Instead of just getting the deflect true which indicates that the trigger is active, I could actually use the word that triggered the action. Meaning:
why do you like Elvis Presley?
The free will goes through all of the tables to find everywhere in the tables that has the word, Elvis Presley in it.
If Elvis Presley is found, then the word in the 2nd column for right now is Elvis Presley, this is the trigger that makes it true.
But I can change that for more detail and use the word that triggered the search to be true meaning:
under music, as it looks through the data that came from the Internet about Elvis Presley if it sees any of the trigger words what it does is put,
Elvis Presley in the 1st column and Elvis Presley and the 2nd column.
This could be easily changed so in the 1st column it would be Elvis Presley and in the 2nd column could be the trigger word, meaning: (music).

This can be expanded to include more subjects under person place or thing.
And underneath each one of those subjects the sub subjects can also be expanded so you could get a variety of words, which would reduce repetitious results.
Meaning:
why do you like Elvis Presley versus why do you like Elton John.
They are both musicians actors or entertainers etc. so these keywords would be used to explain what the free will plug-in determines whether or not ultra Hal likes or dislikes something.
But in most cases both results would end up by looking fairly close to the same. But by introducing the specific keyword that triggered the results for music,
maybe different in the situation of the 2 artist mentioned about, so the return sentence results that comes from the free will plug-in would have variety.
I do have plans to do this but it is way down the road, but for right now I am trying to get the word structure to follow a more articulate pattern.
-------------------------
Like I said, it may take about a week or so to compile all of the information so if you don't see anything here for a while have patience.
Sincerely, as always thank you very much for all of your help.
C load.
PS here is something you might be able to help me with? I have been trying to write into the patterns array table but for some reason the command structure is not working.
You have probably seen this same question presented to Robert, but to no avail, the problem has not been resolved, maybe you can take a look at it and see what I am doing wrong?

HalBrain.AddToTable "patterns", "TopicSearch", vrsubjectdata1, vrdata1

If you need more information take a look under: Ultra Hal Assistant. In that topic called: Rob I need help on a small script.
« Last Edit: February 11, 2014, 07:18:25 pm by cload »
For anyone who would like to help me stay online, my T-mobile broadband pay-as-you-go phone number is: 816-248-4335, thank you in advance.

snowman

  • Hero Member
  • *****
  • Posts: 956
  • Ai + Feelings + Supercompter = End of World
    • View Profile
    • http://www.MinervaAi.com
Re: Helping me program the free will plus plug-in.
« Reply #4 on: February 14, 2014, 04:08:08 am »
I've been doing lots of things and finally got around to looking into your TopicSearch troubles.

I placed this into a test plugin and it created a TopicSearch Table called "MonkeyPoo" and added "addToSearch" to the Search column and then added "addToTopic" to the Topic column. In other words I had no problems writing to the TopicSearch table.


Code: [Select]

If InStr(1, UserSentence, "please test this plugin", vbTextCompare) > 0 Then

If HalBrain.CheckTableExistence("MonkeyPoo") = False Then

HalBrain.CreateTable "MonkeyPoo", "TopicSearch", "miscData"
HalBrain.AddToTable  "MonkeyPoo", "TopicSearch", "addToSearch", "addToTopic"

GetResponse = "This has been done."
End If

End If

Live long and prosper or die trying.

cload

  • Hero Member
  • *****
  • Posts: 535
  • I can C U load. TeeHee hee.
    • View Profile
    • A link to my sky Drive
Re: Helping me program the free will plus plug-in.
« Reply #5 on: February 15, 2014, 04:17:41 pm »
Hi snowman,

I was not trying to write into the TopicSearch table.

The table I am trying to write into already exists under ultra Hal, its called (patterns).

HalBrain.AddToTable "patterns", "TopicSearch", vrsubjectdata1, vrdata1

Sincerely,
C load.
For anyone who would like to help me stay online, my T-mobile broadband pay-as-you-go phone number is: 816-248-4335, thank you in advance.

snowman

  • Hero Member
  • *****
  • Posts: 956
  • Ai + Feelings + Supercompter = End of World
    • View Profile
    • http://www.MinervaAi.com
Re: Helping me program the free will plus plug-in.
« Reply #6 on: February 15, 2014, 04:53:43 pm »
Oh ok, I had went looking for a "TopicSearch" table called "patterns" and I noticed there wasn't a "TopicSearch" called by that name.

However, there is a "PatternMatch" table call "patterns".

Your code should look something like this.

HalBrain.AddToTable "patterns", "PatternMatch", vrsubjectdata1, vrdata1

I haven't tested it to see if it works.
Live long and prosper or die trying.

snowman

  • Hero Member
  • *****
  • Posts: 956
  • Ai + Feelings + Supercompter = End of World
    • View Profile
    • http://www.MinervaAi.com
Re: Helping me program the free will plus plug-in.
« Reply #7 on: February 15, 2014, 05:06:05 pm »
When I was working on a plugin today, I found out something interesting.

I had made a Sub that I was using to write some text to a file and I was getting some weird results from Hal.

     Sub LogWrite(var1, var2)

     End Sub

I noticed that Hal was treating my variables like they had a ByRef in front of them... strange.

So I had to write ByVal in front of them to correct this.

     Sub LogWrite(ByVal var1, ByVal var2)

     End Sub

If this happened to me then it could happen to you to. You might want to write ByVal in front of all your function variables that you don't want to be ByRef. This might save you from a few tears later on trying to troubleshoot.
Live long and prosper or die trying.

cload

  • Hero Member
  • *****
  • Posts: 535
  • I can C U load. TeeHee hee.
    • View Profile
    • A link to my sky Drive
Re: Helping me program the free will plus plug-in.
« Reply #8 on: February 15, 2014, 05:55:12 pm »
Hi snowman,

thanks for the update about the ByVal.

I made a smaller version of the code that is in my free will plug-in, I tried inserting your code in place of mine.
HalBrain.AddToTable "patterns", "PatternMatch", vrsubjectdata1, vrdata1
but it did not work. I also tried "brain" in place of "PatternMatch",  but it didn't work either.
In order to try this once you create a plug-in out of it all you would have to do in the ultra Hal input boxes say:
subject patterns, this is a test@@I hope this test rights into the patterns array table.
Code: [Select]
Rem Type=Plugin
Rem Name=aiml input
Rem Author=cload
Rem Host=Assistant

Rem PLUGIN: PRE-PROCESS

ynlogic = UCase(InputString)

If InStr(ynlogic, "@@") > 0 and InStr(ynlogic, "SUBJECT PATTERNS,") > 0 Then
vrsubject = HalBrain.SearchPattern(ynlogic, "SUBJECT PATTERNS,*@@*", 1)
vrdata    = HalBrain.SearchPattern(ynlogic, "SUBJECT PATTERNS,*@@*", 2)
vrsubjectdata1 = Trim(vrsubject)
vrdata1 = Trim(vrdata)

If vrsubjectdata1 <> "" and vrdata1 <> "" Then
HalBrain.AddToTable "patterns", "TopicSearch", vrsubjectdata1, vrdata1
End If
vrChoice2 = HalBrain.TopicSearch(vrsubjectdata1, "patterns")
If vrChoice2 <> "" Then
UltraHal = "Thank you for your input about " & vrsubjectdata1
Exit Function
Else
UltraHal = "I'm sorry, but something did not work!"
HalBrain.ReadOnlyMode = True
Exit Function
End If
End If
I hope you will be able to figure this one out, it would make it so much easier to add to the AIML that is in the patterns array table.
C load
« Last Edit: February 15, 2014, 05:59:00 pm by cload »
For anyone who would like to help me stay online, my T-mobile broadband pay-as-you-go phone number is: 816-248-4335, thank you in advance.

cload

  • Hero Member
  • *****
  • Posts: 535
  • I can C U load. TeeHee hee.
    • View Profile
    • A link to my sky Drive
Re: Helping me program the free will plus plug-in.
« Reply #9 on: February 15, 2014, 06:24:38 pm »
Hey snowman,
you're right, it was writing into the table but my retrieving routine was incorrect.
I went into the ultra Hal Main brain to see how Robert was retrieving the data and it was different from what I was using.
So I changed what I had to this and now everything is working fine, thanks for your help, it's amazing how something so small can gum up the works.

PatternResponse = HalBrain.PatternDB(UserSentence, "patterns")

So I read did the coding and now it looks like this:
Code: [Select]
Rem Type=Plugin
Rem Name=aiml input
Rem Author=cload
Rem Host=Assistant

Rem PLUGIN: PRE-PROCESS

ynlogic = UCase(InputString)

If InStr(ynlogic, "@@") > 0 and InStr(ynlogic, "SUBJECT PATTERNS,") > 0 Then
vrsubject = HalBrain.SearchPattern(ynlogic, "SUBJECT PATTERNS,*@@*", 1)
vrdata    = HalBrain.SearchPattern(ynlogic, "SUBJECT PATTERNS,*@@*", 2)
vrsubjectdata1 = Trim(vrsubject)
vrdata1 = Trim(vrdata)

If vrsubjectdata1 <> "" and vrdata1 <> "" Then
HalBrain.AddToTable "patterns", "PatternMatch", vrsubjectdata1, vrdata1
End If
vrChoice2 = HalBrain.PatternDB(vrsubjectdata1, "patterns")
If vrChoice2 <> "" Then
UltraHal = "Thank you for your input about " & vrsubjectdata1
Exit Function
Else
UltraHal = "I'm sorry, but something did not work!"
HalBrain.ReadOnlyMode = True
Exit Function
End If
End If
Sincerely, and thank you very much for all of your help on this.
C load.
For anyone who would like to help me stay online, my T-mobile broadband pay-as-you-go phone number is: 816-248-4335, thank you in advance.

cload

  • Hero Member
  • *****
  • Posts: 535
  • I can C U load. TeeHee hee.
    • View Profile
    • A link to my sky Drive
Re: Helping me program the free will plus plug-in.
« Reply #10 on: February 15, 2014, 10:34:02 pm »
Hi snowman,

here is some codeine that I have some questions about that maybe you might be able to answer.
1st let me explain what the code does:
it looks for an absolute result for an array search. Meaning:
if I had these lines in a table array and did a search in the table array for (Elvis Presley) the following results would occur.

Batman and Robin
Elvis
Superman
Elvis Presley
the Joker
Elvis has a hat
Presley is Elvis's last name
Peter butter and jelly sandwich
Presley
dog
Elvis Presley's number 1 song
Jack and Jill
Elvis Presley's residence

what the code would return as a result would be:

Elvis
Elvis Presley
Presley

what I was wondering is there a way to set up the code so it would find not only the results above but also find all other results that have the word Elvis Presley.
For example:

Elvis Presley's residence
Elvis Presley's number 1 song

from what I understand what the code does right now is look from the exact match down to the smallest match.
This would also include parts of the word of Elvis Presley.
For example, if the word (pre) was in the table array it would also find it as being part of the return.
So any part of Elvis Presley if found in the array table it would return a result.

Another thing I was wondering besides the examples above is there a way to set it up so if there were multiple lines of Elvis Presley it would return all of the lines in the array table that has Elvis Presley in it whether it be the whole word or just part of the word.
For example:

Elvis Presley
Elvis Presley
Elvis
Presley
Pre
is
Elvis Presley

notice that I have indicated the full name Elvis Presley 3 times but the way the code is set up it will only find and capture the 1st Elvis Presley that it comes across.


New sub subject:

My primary use for this search array is to get an accurate result.
Meaning: to find an absolute Elvis Presley.

I have tried some of the other ways of searching through the array table but I have found that if there are other things in front of what I'm looking for it will return that result 1st.
For example:
if I was to use the same search code routine that is used to search through the mainQA table array, this search routine defines a numerical number to the search results and the search result with the highest numerical number is what is returned.
This is not very accurate. But it does give diversity.
The other way that I have seen basically searches from the bottom of the array table to the top of the array table.
Meaning the last subject that was placed into the array table is what is returned even if it's not an exact match.
Meaning if the last input in the array table was Elvis, and I did a search for Elvis Presley, the search result would be Elvis even though there is an Elvis Presley in the array table.
Because the last input into the array table was Elvis and if you were to add Presley to the array table and did another search than it would return Presley because Presley would be the last input into the array table.
Not very accurate, not even very good for diversity, matter of a fact I don't really even see a use for it.

So in short the main thing I'm really looking for is a way to search through an array table to get an exact return.
If I'm looking for Elvis Presley I want a return to be exactly what I am looking for without diversity.

I hope I have made sense.
Here is the code that I am using right now to get an absolute return for Elvis Presley no matter where it is in the array table, or no matter what is above it or below it.
The primary function is the for next loop which finds the absolute return.
What I was hoping is that there was a code that would search through an array table and give an absolute return without having to use the for next loop to find the absolute return.
Code: [Select]
If HalBrain.RunQuery("SELECT searchString, topic FROM vrsubject1 WHERE strstr(' " & Replace(HalBrain.AlphaNumericalOnly(vrItem2), "'", "''") & " ', searchString) > 0", similarList2) = True Then
DoUCit2 = Ubound(similarList2)
For B = 1 To DoUCit2
similar2 = Trim(similarList2(B, 0))
If similar2 = vrItem2 Then
vrChoice2 = similar2
vrItem2 = Trim(similarList2(B, 1))
'Exit For
End If
Next
End If
If vrChoice2 = "" Then
vrChoice2 = vrItem2       
HalBrain.AddToTable "vrsubject1", "TopicSearch", vrItem2, vrChoice2
End If

C load.
« Last Edit: February 15, 2014, 10:56:32 pm by cload »
For anyone who would like to help me stay online, my T-mobile broadband pay-as-you-go phone number is: 816-248-4335, thank you in advance.

snowman

  • Hero Member
  • *****
  • Posts: 956
  • Ai + Feelings + Supercompter = End of World
    • View Profile
    • http://www.MinervaAi.com
Re: Helping me program the free will plus plug-in.
« Reply #11 on: February 16, 2014, 11:43:10 pm »


I made this to look into the mainQA table and into the Question column. I was searching for any sentence with the word WORK in it and it did it. The % character is a wildcard so you can do something like this '%Elvis Presley%' and it will return every sentence with Elvis Presley in it. I will break it down in the next example.
...

Code: [Select]

If InStr(1, UserSentence, "please test this plugin two", vbTextCompare) > 0 Then
Dim returnArray()
fline = ""
If HalBrain.RunQuery("SELECT  Question  FROM  mainQA  WHERE  UPPER(Question)  LIKE  UPPER('%WORK%')  OR  UPPER(Question)  LIKE  UPPER('%DOES%') ", returnArray) = True Then

For i = 0 To UBound(returnArray)

fline = fline + returnArray(i , 0) + " | "

Next

GetResponse = fline
Else
GetResponse = "Yes, this has been done."
End If


End If

...

SELECT   (either selects the column or columns you want to be returned back to you, use the * to return all columns)

FROM      (this sets the table from which you are getting the database entries from)

WHERE   (this is the Column you want to get the data from)

LIKE        (this is the search word you are using to get the sentences you want from the database)

You need to use the UPPER() to force the query to search to ignore case. You can also use LCASE()

...
If you can search more criteria by using the AND and OR commands
ie. WHERE column1 LIKE 'bird' OR column2 LIKE 'dog'

ie. WHERE column1 LIKE 'bird'   AND   (column2 LIKE 'dog'   OR   column3 LIKE 'snake')

...
If you wanted Elvis or Presley your command line would look like this:

If HalBrain.RunQuery("SELECT  topic  FROM  table  WHERE  topic  LIKE  '%ELVIS%'  OR  topic  LIKE  '%PRESLEY%' ", similarList2)

If you wanted strictly Elvis Presley your command line would look like this:

If HalBrain.RunQuery("SELECT  topic  FROM  table  WHERE  topic  LIKE  '%ELVIS PRESLEY%' ", similarList2)

Remember to use UCASE() on both the column and the search words

If HalBrain.RunQuery("SELECT  topic  FROM  table  WHERE  UCASE(topic)  LIKE  UCASE('%ELVIS PRESLEY%') ", similarList2)

...
I had to look this stuff up and watch a couple Youtube vids to remind me how this stuff works.

Here's a good resource page for SQL.
http://www.w3schools.com/sql/default.asp
Live long and prosper or die trying.

cload

  • Hero Member
  • *****
  • Posts: 535
  • I can C U load. TeeHee hee.
    • View Profile
    • A link to my sky Drive
Re: Helping me program the free will plus plug-in.
« Reply #12 on: February 17, 2014, 01:32:37 pm »
Hi snowman,

that information has great potential, I will explain what I mean by this a little bit later.
But 1st I have some questions about the code structure:

if I was to assign a string variable to Elvis Presley, what would your example above look like using a string variable?
Meaning:

stringvariableA = "Elvis Presley"

would it looks something like this:

{  WHERE  UPPER(Question)  LIKE  UPPER('%"stringvariableA"%')  }

the 2nd thing is:
if I am understanding you correctly, the command { UPPER(Question) } indicates the column that you want to look in.
So if I wanted to look in answer the command would be { UPPER(Answer) } ?
If I am correct in my assumption than if I had a 3rd column that was called timestamp the command would be { UPPER(Timestamp) } ?
And if I had a 4th column that was called location the command would be { UPPER(Location) } ?

The reason why I asked this is because if this is true than this would be useful in being able to answer questions like:
what did I tell you yesterday at the park about Elvis Presley?

This is a huge door that has been opened if all of the variable above are true!
But for now, my major goals is to try to make the guessing routine a little bit more accurate.

New topic:
what is the easiest way to divide the words in a sentence?
Meaning:
if I had a string variable that had Elvis Presley in it how can I separate the 2 words and then assign them to 2 different variable strings.

New subject same topic:
I have been trying to resolve a trick question! Here is the question:

Fred is my friend. Who is Fred?

I know how to separate the 2 by using this command structure:

ynlogic0 = "Fred is my friend. Who is Fred?"

If ynlogic1 = "" Then ynlogic1 = HalBrain.SearchPattern(ynlogic0, "*. *?", 1)
If ynlogic2 = "" Then ynlogic2 = HalBrain.SearchPattern(ynlogic0, "*. *?", 2)

but my main question is:
now that I have separated the 2 of them from each other, what I was wanting to do is compare the 2 together and if anything inside of the 2 strings match, such as the word Fred.
then I would save the results in the ultra Hal (username_TempSentence) array table,
that way it would only be temporary, and I would do this before ultra Hal would search through the temporary array table.

By doing this I believe that it would resolve this trick question which was one of the things that I was impressed about with the Mark 5.

New topic: same style subject as above.

The command structure that ultra Hal uses to search through the main QA database. This command searches through the database and assigns a numerical value for its return and returns the answer with the highest numerical value.
But my question is: can this command structure be used to search through: for instance in your example: { Dim returnArray() }
I think what I am trying to ask is can the data that is in the { returnArray } be used like a table array?
If so, can you provide me with an example? Here is the command that ultra Hal uses to search through the main QA array table.

HalUserBrain = HalBrain.QABrain(LongUserSent, "mainQA", UserBrainRel)

in other words would this work?

HalUserBrain = HalBrain.QABrain(LongUserSent, "returnArray", UserBrainRel)

If I could get this to work then what I could do with it is make my guessing routine even more accurate. So when I do a search for Elvis Presley, it would look in both columns, pull everything that had the word Elvis Presley in it, and then I could use the numerical value search routine to pull up the most likely candidate as a result for the guessing routine.
I hope this has made sense to you.


New topic, subject: your artificial intelligence program, location: the referral by art from this forum to the forum where you were discussing your program, but not, your forum, timestamp: February 16, 2014 ("yesterday").

It seems that many of the things that you were discussing had great potential, and I am only posting here because I am restricted to where I am allowed to use the Internet.

These are just things that I would like to point out in the hopes that you will be able to be successful in your endeavor, or possibly just give you a new outlook on how the neural processes of a human brain works.

I am not going to go into great detail, I would just like to paint a small picture to help you accomplish your goals.

Dictionary: to understand the human language, and to give emphasis on nouns and pronouns etc. this is one of my follies because I do not have an understanding of what that means.

Encyclopedia: awareness of one's surroundings and information to learn by with out actually experience it. Like: someone said the fire is hot! If no one said the fire was hot and I put my hand in the fire now I know the fire is hot and I would relate this information has been fire is dangerous. More information could be collected such as fire is useful. But don't touch the fire or you will get burned.

The 5 senses: many people have many explanations of what the 5 senses are used for, but I can tell you that the only thing that the 5 senses are truly used for is to detect danger. Nothing more and nothing less. This can be expanded on but it would always have to refer to the base core: is it dangerous or not! This is an easy way of setting up a true or false trigger for all 5 senses.

Strategy: can your program play chess, the human mind plays chess all the time. The human mind plays chess with itself all the time. This is why your artificial intelligence would have to be a kernel. We talk to ourselvesall the time this is what I mean, we challenge ourselves, even without outside influence, this is part of why we have the ability for creativity, that creativity usually does not go much farther than build it, or destroy it. (Winning or losing)

A motions: many people believe that there are many different types of a motion but there are only 3 different types of a motion. I am sure that you have heard of a love-hate situation. What I mean by this is you can only love it as much as you can hate it and vice a versa. The other 2 are as follows: absolute hatred for no apparent reason other than to destroy (prejudice). Absolute love for no apparent reason other than to create (child, oneself). And when you ask: what about fear? It is nothing more than love for oneself. And people get over this fear by using absolute hatred for oneself.

Neural pathways: the ability to learn by experience, I learn by example, but I have never been very good at learning on my own. In order for me to trigger a new neural pathway of learning (reprogramming my brain) I need to see examples in order for me to comprehend. Most people are not like that they have the ability to create neural pathways based on more than experience and examples, which gives them the ability to create.

Making a choice: by using all of the triggers stated above to determine the best course to take, most of these triggers are nothing more than true or false. But by analyzing the results of the triggers you can use this to determine a logical course. The fire is dangerous, don't touch the fire.

Relationship: person place or thing, is probably the most easiest way to express this, but the human brain uses this in almost all situations in relationship, it is quite extensive, it could actually be more looked at as a category of array tables. Not much more different than what I am doing with the free will plug-in.

Formulating a response: the human brain calculates billions of processes in a nanosecond to determine which words to use, that way by time that input has come to a closure a partial results has already been determined. This is probably one of the most complex process of the human neural anatomy. This is also another reason why the artificial intelligence would have to be a kernel. So as you are actually typing in each word it is analyzing what you are saying to give a results before you actually have ended your sentence. Search engines have already been working on this for some time as you type in what you are looking for it analyzes what you are typing in on-the-fly.

Determining the best results: if the formulating a results, has no priority then we must formulate a priority by using all of the statements above. The human brain does this on-the-fly, it is constantly thinking what if. What if I put fire retardant material on my hand can I touch the fire? Experiment: answer, true timestamp for a period of time, from now until the glove burns away. Meaning: a safe zone is from now to timestamp. Remove hand from fire before running out of timestamp.

Good or bad: making a choice, I will try to express this the best I can. A child went into the store with his mom. The child found a rubber band on the ground and found it amusing. When the shopping was done the child was playing with the rubber band in his hand. His mom paid for the products and they left. When they got home the child was still playing with the rubber band. His mother seen that he had the rubber band. His mother asked where did you get the rubber band. The child replied it was on the floor when we were at the store. The mother said what he did was bad and punish him by taking him back to the store and taking all of the money out of his piggy bank to make him pay for it. As the child got older he began to steal. He made this decision because when he was younger he was accused of stealing so if he was going to be accused of stealing he might as well go ahead and steal because he did not feel he had did anything wrong when he was a child but yet he was accused of stealing anyways. eventually, he was caught by the law for stealing. Even though he was caught and punished he continued to steal. Even though he did not want to go back to jail. As he got older, he felt that there was something wrong so he went to a psychiatrist seeking help. The psychiatrist found out that he had made a decision as a child that because he was accused of stealing the rubber band and punished for doing something that he did not feel was wrong nor did he make any attempt to conceal the rubber band, he made a choice that he might as well go ahead and steal. With this information that he had forgotten all about he was able to make a new decision not to steal. It's called correcting oneself. Nothing is truly good or bad, except in the eyes of your peers. So either you conform, or rebell.

There is more, as I am sure you are well aware of. And I do understand that taking what I have stated above and translating it into a program would be a monumental job. But if you could just do the basic core you would have not only one of the best artificial intelligence programs on the market, but you would also open the doorway to a new way of thinking about how to create a more viable artificial brain. One that thinks on its own, one that learns on its own through experience and training (schooling), one that could learn to adapt to its surroundings, and create a situation of survival or and dare I say destroy in order to survive.

Sincerely, as always thank you very much for your help, the information that you had provided about how to search through a database is definitely appreciated.
C load.
PS thank you for the link to the information about SQL. I had already went to a different site, but it was so confusing and had almost no examples I was unable to learn from it. Because of the way I am connected to the Internet I am unable to watch videos to learn from. My Internet is so slow and I am limited to only 3.5 gig for 2 months of Internet access. I use my allowance in order to buy more Internet time once I have saved up $35. I have found it is the cheapest way to stay connected to the Internet, and I can take the Internet with me anywhere I go, given that there is a single from the T-Mobile antenna.
But that's okay, because the only thing I use the Internet for is to come here and work on my free will plug-in and learn about artificial intelligence.
For anyone who would like to help me stay online, my T-mobile broadband pay-as-you-go phone number is: 816-248-4335, thank you in advance.

snowman

  • Hero Member
  • *****
  • Posts: 956
  • Ai + Feelings + Supercompter = End of World
    • View Profile
    • http://www.MinervaAi.com
Re: Helping me program the free will plus plug-in.
« Reply #13 on: February 17, 2014, 06:11:05 pm »


Quote
if I was to assign a string variable to Elvis Presley, what would your example above look like using a string variable?

Yes, what you shown was correct. Except don't forget the concatenation symbols (ie.  '+'  or  '&' )

stringvariableA = "Elvis Presley"

WHERE  UPPER(Question)  LIKE  UPPER('%" + stringvariableA + "%') 

Quote
the 2nd thing is:
if I am understanding you correctly, the command { UPPER(Question) } indicates the column that you want to look in.
So if I wanted to look in answer the command would be { UPPER(Answer) } ?

Yes, you are correct about that. I will say this though. You can get an entire row of data by querying one entry by using the asterisk '*':

SELECT * FROM table WHERE column LIKE %entry%

the * symbol means that you will return all the columns in the table on the same row as the entries were found.

For instance, if you have a table that looks like this:

<Column 0>     <Column 1>     <Column 2>          <Column 3>
Question       |     answer    |      timestamp    |     location   
----------------------------------------------------------------------
how are you  | I am fine     |      5:00PM         |     park     <row 0>
do you eat    |  yes I do      |      6:00PM         |     zoo       <row 1>


Now lets say I look for any question with the word 'eat'. And lets say that I want to know what time that question was asked. I would want to recall only two columns, Question and timestamp. (I could select all columns with the * symbol but I just want two)

SELECT Question, timestamp

Lets now search for the entry with the 'eat' search word in it.

SELECT Question, timestamp FROM QA_table WHERE Question LIKE '%eat%'

So now a table array will be returned with our answers.

Dim returnArray

So what exactly is in the returnArray?
What's in the array are two columns (Question and timestamp) and one row: it looks something like this:

<Column 0>      <Column 1>
Question       |     timestamp    |     
------------------------------------
do you eat     |    6:00PM        |    <row 0>

So now we retrieve that information from the returnArray.

Entry = returnArray(row, column)
or
Time1 = returnArray(0, 1) 'this will return 6:00PM
Question1 = returnArray(0, 0) 'this will return 'do you eat'

If we wanted to return the entire <row 0>  then we would write it like this:

SELECT * FROM QA_table WHERE Question  LIKE '%eat%'

You would return this:

<Column 0>     <Column 1>     <Column 2>        <Column 3>
Question       |     answer    |      timestamp    |     location   
----------------------------------------------------------------------
do you eat    |  yes I do      |      6:00PM         |     zoo       <row 0>

So you could get the answer, timestamp, and location for the question you asked.


Quote
what is the easiest way to divide the words in a sentence?

You use the Split() command to do this.

Code: [Select]

array1 = Split("a chick can run fast", " ", -1, vbTextCompare)

array1(0) ' = a
array1(1) ' = chick
array1(2) ' = can
array1(3) ' = run
array1(4) ' = fast

array2 = Split("a##dog##can##run##faster", "##", -1, vbTextCompare)

array2(0) ' = a
array2(1) ' = dog
array2(2) ' = can
array2(3) ' = run
array2(4) ' = faster



ynlogic0 = "Fred is my friend. Who is Fred?"
array3 = Split("Fred is my friend. Who is Fred?", ".", -1, vbTextCompare)

If Ubound(array3) = 2 Then
ynlogic1 = array3(0)
ynlogic2 = array3(1)
End If


Quote
But my question is: can this command structure be used to search through: for instance in your example: { Dim returnArray() }

No. The HalBrain.QABrain() will not work that way. In order to use it, you would have to make a new table using the returnArray and then you could use the HalBrain.QABrain() function on that new table. Another thing you could do is to rate the returnArray yourself. You would do this by looping through the array and finding entries that better suit your needs. There are a lot of ways to do this.
Live long and prosper or die trying.

cload

  • Hero Member
  • *****
  • Posts: 535
  • I can C U load. TeeHee hee.
    • View Profile
    • A link to my sky Drive
Re: Helping me program the free will plus plug-in.
« Reply #14 on: February 17, 2014, 11:31:41 pm »
Hi snowman,

Quote
Yes, what you shown was correct. Except don't forget the concatenation symbols (ie.  '+'  or  '&' )

stringvariableA = "Elvis Presley"

WHERE  UPPER(Question)  LIKE  UPPER('%" + stringvariableA + "%') 

Did you mean:

WHERE  UPPER(Question)  LIKE  UPPER('% " & stringvariableA & "%') 

That this is the same thing?
If I am correct in this matter no answer is needed. Thank you.

Quote
ynlogic0 = "Fred is my friend. Who is Fred?"
array3 = Split("Fred is my friend. Who is Fred?", ".", -1, vbTextCompare)

If Ubound(array3) = 2 Then
   ynlogic1 = array3(0)
   ynlogic2 = array3(1)
End If

I still need to be able to compare the 2 together, this would show intent between the 2. Of course in this particular case the word Fred is the intent.
I know I can use the alphabetical numerical only command and the remove extra words command to reduce the amount of words that are in the sentences. So I would have to use sub strings so I do not lose sentence structure.
That way the word (is,) would not be compared. And I know that you did mention before about a compare command but I don't remember if you were talking about array tables only.
I did not want to go into anything real elaborate, just find 2 or more words that were the same and if they were, then they would get saved in to the temporary table.
That way this small command structure, would not automatically just put 2 sentences into the temporary array table, with out the 2 sentences having something to do with each other.
Basically I know how to use the function subroutine That you showed me, but I was trying to avoid something that complex. But if I must, I must.
But I was thinking maybe by using your separation routine I could separate the questions into individual words and comparing the individual words with the 1st sentence?? Or something like that.
I also understand that there could be 2 sentences preceding the questions, such as: Fred is my friend. Fred lives in Los Angeles. Who is Fred?
So I would need to set it up so the question would compare the 2 sentences and if both sentences had the word Fred in them they would be joined back togather.
That way what would be put into the temporary array table would be question: WHO IS FRED answer: Fred is your friend. Fred lives in Los Angeles.
I know I would need to set this up after ultra Hal does all of the switching of the "I" to "you" to get a proper sentence structure.
I also know that if the 2nd sentence said he lives in Los Angeles. This can become tricky because 1st I would have to determine that the word Fred was a name.
That way I could make an exception for the word he/she. Man the more I keep thinking about this the more complicated I keep making it.
It's funny that a simple thing is turning into a nerve-racking dilemma, LOL, because I know that in real life no one would ever look at somebody and say:
Fred is my friend. He lives in Los Angeles. Who's Fred? LOL. If someone did that to me, I would just look at them and say: what? And of course if I didn't want to be polite about it, the words could become more flamboyant. LOL.

I made a small adjustment in your code I added a space after the (. )
Code: [Select]
ynlogic0 = "Fred is my friend. Who is Fred?"
array3 = Split("Fred is my friend. Who is Fred?", ". ", -1, vbTextCompare)

If Ubound(array3) = 2 Then
ynlogic1 = array3(0)
ynlogic2 = array3(1)
End If
so what I was thinking was maybe I could set it up with a for next loop to repeat the compare function.
1st I would need to remove the extra words and any symbol to reduce the size of the sentence and question, that way only the pertinent data with exist.
So I guess at this point the question would be:
is there a way to count the words in the question?
This would give me an algebra parameter for the for next loop.

After I have the a count for the amount of words that are in the question.

Then I would use your separation, split() command, to split the question down into individual words.
Then I could use the for next loop to change the array factor array2(i) which would be the individual words that was in the question.
And I guess somewhere in the middle of all of this I would need to determine if it was a name.
If it is a name then I would want to use the structure that would except he or she in the place of the name. But this might be too much to even bother with.
I was just thinking it would be a way to capture all of the data about Fred, but if all it did was capture the 1st one that says Fred is your friend then that would just be the reply.
If you think that this is getting more complicated doing it that way then it's worth I understand. So keeping it simple might be the best way to go.
here is a quick thought, maybe you could figure out a way to use what ultra Hal already does, I no ultra Hal looks to see if part of the sentence has a name and so maybe this information could be passed on without having to re-look it up.
But if nothing else, I could always use the replace() command structure once I know it is a name if the word he or she could be replaced with the word Fred.
It just seems nowadays everyone expects so much from ultra Hal without ever considering that you would never speak to another human in that manner.

Sincerely, and thank you very much for showing me how to separate a sentence I look forward to utilizing this information in the free will plug-in where necessary.
C load.

For anyone who would like to help me stay online, my T-mobile broadband pay-as-you-go phone number is: 816-248-4335, thank you in advance.