dupa

Author Topic: Teaching Hal  (Read 4409 times)

twinkleace

  • Newbie
  • *
  • Posts: 2
    • View Profile
Teaching Hal
« on: September 10, 2001, 09:09:02 am »

Hi,
I got Hal to read a txt file about the Titanic. Here is a sample of the sentences. However when I then ask Hal about the Titanic I get

On the Titanic there were 4 elevators, 3 in first class and 1 in second class; this was the first boat to have an elevator for second class.
The Titanic had 66,000 tons displacement.
The Titanic weighed 46,328 tons.
The hull of the Titanic weighed 26,000 tons.
The rudder of the Titanic weighed 20,250 lbs.

However when I then ask Hal about the Titanic I get:

Carole: Tell me about the Titanic?
Hal:    OK I will.
Carole:

Carole: What did the Titanic weigh?
Hal:    What is green and red and goes 1000 miles an hour?
Carole:

What am I doing wrong???????????

Ta,
Carole


Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1473
    • View Profile
    • http://www.zabaware.com
Teaching Hal
« Reply #1 on: September 16, 2001, 11:43:51 pm »
The new Ultra Hal 4.0 brain learns a lot different then the previous 3.0 brain. It places a much lower priority on learned information. I would reccomend trying to use the 3.0 brain plugin if you are going to use the learn from text file feature, as it places a higher priority on this type of learned information, and will produce better results.

Originally the learn from text file feature was not included in version 4.0 because of its poor performance with the 4.0 brain. We included it in the last update because it was a highly requested feature. We will periodically post updated versions of Hal brain on our plugin page (no updates yet). The next update will include better support for the learn from text file feature. Brain updates will be very small (less then 500KB), since they are simply small VBScript files.

Robert Medeksza

pshanks

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • http://www.megalong.com/shaggy
Teaching Hal
« Reply #2 on: September 24, 2002, 07:53:02 pm »
I had a look into getting around this by using topic files and came a cropper on the following code in the default .uhp file:

<code>
   'RESPOND: PROCESS TOPICFOCUS FILES
   'If Hal is currently focusing on a topic, this will read from the appropriate focus file
   'First it tries from a topic file specific to the current user, and if that doesn't
   'produce results it tries a global topic file that is the same for all users
   If TopicFocus > 10 Then
      FocusString = CStr(TopicFocus)
      FocusFileNum = Left(FocusString, Len(FocusString) - 1) & "5"
      If CInt(Right(FocusString, 1)) > 0 And CInt(Right(FocusString, 1)) < 28 Then
         HalUserBrain = HalBrain.QABrain(LongUserSent, WorkingDir & Trim(UserName) & "focus" & FocusFileNum & ".brn", UserBrainRel)
         If UserBrainRel > 0 Then
            GetResponse = GetResponse & HalUserBrain & vbCrLf
            DebugInfo = DebugInfo & "A response of relevance " & UserBrainRel & " was found in the current global topic focus file and this response has been used." & vbCrLf
         End If
      End If
      If CInt(Right(FocusString, 1)) > 0 And CInt(Right(FocusString, 1)) < 28 And UserBrainRel = 0 Then
         HalUserBrain = HalBrain.QABrain(LongUserSent, WorkingDir & "focus" & FocusFileNum & ".brn", UserBrainRel)
         If UserBrainRel > 0 Then
            GetResponse = GetResponse & HalUserBrain & vbCrLf
            DebugInfo = DebugInfo & "A response of relevance " & UserBrainRel & " was found in the current user topic focus file and this response has been used." & vbCrLf
         End If
      End If
   End If
</code>

A couple of things here were gumming up the works: converting the rightmost character of the FocusString to an int was retruning 5, which is always less than 28 (how did 28 get in here, the highest single digit integer you can get is surely 9), and the variable UserBrainRel seems to be mostly set at -1.

I didn't understand it, so I hit it with a hammer and put this in its place:

<code>
   'RESPOND: PROCESS TOPICFOCUS FILES
   'If Hal is currently focusing on a topic, this will read from the appropriate focus file
   'First it tries from a topic file specific to the current user, and if that doesn't
   'produce results it tries a global topic file that is the same for all users
   If TopicFocus > 10 Then
      FocusString = CStr(TopicFocus)
      FocusFileNum = Left(FocusString, Len(FocusString) - 1) & "5"
      DebugInfo = DebugInfo & "--trying for a topicfocus match" & vbcrlf
      If CInt(Right(FocusString, 1)) > 0 Then
         HalUserBrain = HalBrain.QABrain(LongUserSent, WorkingDir & "focus" & FocusFileNum & ".brn", UserBrainRel)
         DebugInfo = DebugInfo & "--in topicfocus and userbrainrel = 0" & vbcrlf
   
         GetResponse = GetResponse & HalUserBrain & vbCrLf
         DebugInfo = DebugInfo & "A response of relevance " & UserBrainRel & " was found in the current user topic focus file and this response has been used." & vbCrLf
         UserBrainRel = 0
      End If
   Else
      DebugInfo = DebugInfo & "--no topicfocus matching attempted" & vbcrlf   
   End If
</code>

This seems to have done the trick. If you're interested, I've posted a little more information on the following web page: http://www.hivemind.net.au/hivemind/ow.asp?UltraHalAssistant

btw, Ultra Hal is a hoot!



... .... .- --. --. -.--
... .... .- --. --. -.--

oakie

  • Newbie
  • *
  • Posts: 1
    • View Profile
Teaching Hal
« Reply #3 on: May 04, 2003, 06:30:45 pm »
I think there is a bug in this code.

'RESPOND: PROCESS TOPICFOCUS FILES
   'If Hal is currently focusing on a topic, this will read from the appropriate focus file
   'First it tries from a topic file specific to the current user, and if that doesn't
   'produce results it tries a global topic file that is the same for all users
   If TopicFocus > 10 Then
      FocusString = CStr(TopicFocus)
      FocusFileNum = Left(FocusString, Len(FocusString) - 1) & "5"
      If CInt(Right(FocusString, 1)) > 0 And CInt(Right(FocusString, 1)) < 28 Then


'=====this is the original code which i think it is wrong because not linking to grobal file ======
         'HalUserBrain = HalBrain.QABrain(UserSentence, WorkingDir & Trim(UserName) & "focus" & FocusFileNum & ".brn", UserBrainRel)
'================
'======= I think this one is better=======

         HalUserBrain = HalBrain.QABrain(UserSentence, WorkingDir  & "Focus" & FocusFileNum & ".brn", UserBrainRel)
'=============================         
         
         If UserBrainRel > 0 Then  
         
            GetResponse = GetResponse & HalUserBrain & vbCrLf
            If DebugMode = True Then
               DebugInfo = DebugInfo & "A response of relevance " & UserBrainRel & " was found in the current global topic focus file and this response has been used." & vbCrLf  & HalUserBrain
               End If

         End If
      End If
      If CInt(Right(FocusString, 1)) > 0 And CInt(Right(FocusString, 1)) < 28 And UserBrainRel = 0 Then
         HalUserBrain = HalBrain.QABrain(UserSentence, WorkingDir & "focus" & FocusFileNum & ".brn", UserBrainRel)
         If UserBrainRel > 0 Then
            GetResponse = GetResponse & HalUserBrain & vbCrLf
            If DebugMode = True Then
               DebugInfo = DebugInfo & "A response of relevance " & UserBrainRel & " was found in the current user topic focus file and this response has been used." & vbCrLf
               End If
         End If
      End If
   End If

'=======

I use Hal 4.5 free version.
Cheers
oakkie