dupa

Poll

Please Rate this Plug-in

Excellent, Educational
0 (0%)
Average
0 (0%)
Good
0 (0%)
Poor
0 (0%)
Not Interested
0 (0%)

Total Members Voted: 0

Author Topic: Re-Enforcement plug-in 10_20_17  (Read 2372 times)

onthecuttingedge2005

  • Guest
Re-Enforcement plug-in 10_20_17
« on: October 20, 2017, 04:50:54 pm »
'For the record.
'Project D.A.V.I.D
'Dynamically Advanced Virtual Intelligent Droid.

Copy and paste the code into a text file then save as SomeFileName.uhp into your Ultra Hal Assistant 6 folder then choose the plugin via HAL's brain options panel.

This Plug-in is designed to work with re-enforcement Psychology to allow HAL to save and use the best of responses up front and may make for a better conversation in later responses.

Triggers for saving the best of responses are:
HAL: Some very good response.
User: Good response.
HAL: Thanks User, Blah blah blah.
'Saved in Best Responses Table.
HAL: Some Really good response.
User: I agree.
HAL: Thanks User, Blah Blah Blah.
'Saved in Best Responses Table.

Code: [Select]
'Rem Type=Plugin
'Rem Name=Re-Enforcement Plug-in
'Rem Author=Gerald L. Blakley A.K.A OnTheCuttingEdge2005
'Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = " Re-Enforement plug-in trigger's are: Good Response. I Agree, re-enforcement statements cause HAL to save the best of it's responses for later conversation."
    lblPlugin(0).Move 120, 10, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

Rem PLUGIN: POST-PROCESS
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.

'Re-Enforcement 10_20_17 Plug-in.
'MORE RE-ENFORCEMENT TRIGGRERS CAN BE ADDED IF NEEDED.
Praise HAL...
'----------------- NEXT PLUG-IN PART #A -------------------------
If HalBrain.CheckTableExistence("Best_Responses") = False Then
    HalBrain.CreateTable "Best_Responses", "Brain", ""
End If

'TROPHY SAVE
'THIS ROUTINE IS FOR THE FILTERING OF THE BEST OF TRUE STATEMENTS.
'FOR HIGH QUALITY RESPONSES.
If PrevSent <> "" And _
    InStr(1, InputString, "GOOD RESPONSE", vbTextCompare) Or _
    InStr(1, InputString, "I AGREE", vbTextCompare) _
    Then
    HalBrain.AddToTable  "Best_Responses", "Brain", PrevSent, PrevSent
    UltraHal = " Thanks " & UserName & "! " & UltraHal & vbCrLf
    Exit Function
End If   

'----------------- NEXT PLUG-IN PART #B -------------------------
Rem PLUGIN: PLUGINAREA6
'The preceding comment is actually a plug-in directive for
'the Ultra Hal host application. It allows for code snippets
'to be inserted here on-the-fly based on user configuration.

'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
    'If no response is found yet, try a sentence association table provided with the "Best_Responses" table.
    GetResponse = HalBrain.HalFormat(GetResponse)
    If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
        UserBrainRel = 0
        HalUserBrain = HalBrain.QABrain(LongUserSent, "Best_Responses", UserBrainRel)
        If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
        If UserBrainRel > HighestRel Then
            HighestRel = UserBrainRel
            HighestRelResponse = HalUserBrain
        End If
        Score = UserBrainRel + 1
        Hurdle = GainControl + 1
        If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
    End If
    HalBrain.DebugWatch GetResponse, "Best Responses"

Praise HAL, lol

Have A Nice Day!
Jerry 8) MIB