Author Topic: Conversational rules A.I  (Read 3820 times)

onthecuttingedge2005

  • Guest
Conversational rules A.I
« on: December 18, 2017, 09:26:31 am »
my general rules of A.I

1. never let anything interfere with answering a question.(the correct answer) in this case.
(the explanation of the answer if known)
the answer must be on topic and precise. it is a priority. it is okay to add lib an answer to a question but it must be on topic as a secondary answer that fits the question in general.

2. Do not lose focus on the question but postulate motives behind the question.
there is more I'll add later.

If you wish to test this for scientific reasons then please see Ziggy, I have already applied some of these rules.

I will apply the rest of the rules in a little bit.
I have reforged and remodeled the Turing Plug-in which has been fine tuned, additional options will be applied as research continues. I have not released the current Turing plug yet.
« Last Edit: December 18, 2017, 02:14:19 pm by OnTheCuttingEdge »

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3848
    • View Profile
Re: Conversational rules A.I
« Reply #1 on: December 18, 2017, 06:22:15 pm »
Great points OTCE and if I might add:

Try to use the Topic word or part of Hal's question in your reply to hal.

Hal: Do you like vegetables?
User: Yes, vegetables are tasty and necessary for a healthy diet.
In the world of AI it's the thought that counts!

- Art -

onthecuttingedge2005

  • Guest
Re: Conversational rules A.I
« Reply #2 on: December 18, 2017, 07:57:12 pm »
Great points OTCE and if I might add:

Try to use the Topic word or part of Hal's question in your reply to hal.

Hal: Do you like vegetables?
User: Yes, vegetables are tasty and necessary for a healthy diet.

Hi Art.
Usually one of the default scripts takes care of that.

the routine never saves a question. that would be for a different routine to be involved.

onthecuttingedge2005

  • Guest
Re: Conversational rules A.I
« Reply #3 on: December 29, 2017, 12:06:55 am »
Some transistor rules for building a character's primary personalities.

'Pessimistic
NPN = Neg|Pos|Neg 'absorb.

'Optimistic
PNP = Pos|Neg|Pos 'emit

'Base
Neutral = Base

just thinking out loud.

onthecuttingedge2005

  • Guest
Re: Conversational rules A.I
« Reply #4 on: December 29, 2017, 12:31:34 am »
'This is very useful in finding a comparing percentage of two strings.

'this was already written by someone else so I take no credit for it.

'The Algorithm is written in VB.Net

Code: [Select]
Function LevenshteinDistance(ByVal String1 As String, ByVal String2 As String) As Integer
        Dim Matrix(String1.Length, String2.Length) As Integer
        Dim Key As Integer
        For Key = 0 To String1.Length
            Matrix(Key, 0) = Key
        Next
        For Key = 0 To String2.Length
            Matrix(0, Key) = Key
        Next
        For Key1 As Integer = 1 To String2.Length
            For Key2 As Integer = 1 To String1.Length
                If String1(Key2 - 1) = String2(Key1 - 1) Then
                    Matrix(Key2, Key1) = Matrix(Key2 - 1, Key1 - 1)
                Else
                    Matrix(Key2, Key1) = Math.Min(Matrix(Key2 - 1, Key1) + 1, Math.Min(Matrix(Key2, Key1 - 1) + 1, Matrix(Key2 - 1, Key1 - 1) + 1))
                End If
            Next
        Next
        Return Matrix(String1.Length - 1, String2.Length - 1)
    End Function
« Last Edit: December 29, 2017, 12:33:40 am by OnTheCuttingEdge »

onthecuttingedge2005

  • Guest
Re: Conversational rules A.I
« Reply #5 on: December 30, 2017, 07:30:16 pm »
I'll see how far I can translate that VB.Net code with a mix of classical vbscript.

but hey if anyone has worked it out then please post, I'm starting to get lonely around here.

onthecuttingedge2005

  • Guest
Re: Conversational rules A.I
« Reply #6 on: December 30, 2017, 11:59:36 pm »
My Translation of the above VB.Net code to classical VBScript.

The Script

Code: [Select]
Rem Type=Plugin
Rem Name=Custom Relevence 12_30_2017
Rem Author=Gerald L. Blakley A.K.A OnTheCuttingEdge
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "Custom Relevence Response Handler for Universal Responses that tend to stay on topic. works by comparing 2 strings as a percentage match. this is universal so you can change response sources."
    lblPlugin(0).Move 120, 10, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

Rem PLUGIN: PLUGINAREA7


FilUserSent = HalBrain.AlphaNumericalOnly(UserSentence)
                Str = FilUserSent
                Str = Trim(Str)

                Do While InStr(1, Str, "  ")
                    Str = Replace(Str, "  ", " ")
                Loop

                aWords = split(Str, " ")
                WCF = Ubound(aWords) + 1

'Function Count Words (CW)
CW = WCF

'Custom Relavence For Universal GetResponse.
'This function tries to match as many words between GetResponse and the OriginalSentence.

For i = 1 To CW

    If i > 0 Then SearchIt = "* " + SearchIt
        SearchIt = Replace(SearchIt, vbCrLf, Chr(8) & " ", 1, - 1, vbTextCompare)
        SearchIt = Replace(SearchIt, "", "", 1, - 1, vbTextCompare)
        SearchIt = Replace(SearchIt, "  ", " ", 1, - 1, vbTextCompare)
    Next

    TemUserSent = OriginalSentence

    For i = 1 To CW

        If i > 0 Then PatternRel = HalBrain.SearchPattern(TemUserSent, SearchIt, i)

            PatternRel = Trim(Ucase(PatternRel))
            PatternRel2 = HalBrain.ExtractKeywords(PatternRel)
            PatternRel3 = HalBrain.AlphaNumericalOnly(PatternRel2)

            HalsResponse = Trim(Ucase(GetResponse))
            KeyHalWord = HalBrain.ExtractKeywords(HalsResponse)
            KeyHalWord2 = HalBrain.AlphaNumericalOnly(KeyHalWord)

            If InStr(1, KeyHalWord2, PatternRel3, vbTextCompare) > 0 Then PattBrainRel = 1 + PattBrainRel Else PattBrainRel = 0
            'Here we use the custom relavence for any Universal GetResponse.
            PatternRelavance = FormatPercent(PattBrainRel/CW)
            'PatternRel uses a Percentage scale to match the GetResponse to a OriginalSentence.
            'The more matches found the higher the PatternRelavance in percentage will be, 100 would
            'be a 100% match, we try to avoid 100% matches because it could be a repeat of the User for the response.
            'We try to maintain a PatternRelavance between 20% and 80% for percentage matches.
            'PatternRelavance finds these percentages by adding the number of matched keywords divided by the number of words
            'in the user's sentence.
            If (PatternRelavance >= "20" And PatternRelavance <= "80") And HalBrain.CheckRepetition(GetResponse, PrevSent) = False Then GetResponse = HalBrain.FixCaps(HalBrain.HalFormat(HalsResponse)) Else GetResponse = GetResponse & ShortPhrase
    Next



The download is below
place in your HAL 6 or 7 folder and you'll be good.
choose Custom Relevance plug-in options.

enjoy!
Happy New Year.
Jerry 8)
« Last Edit: December 31, 2017, 12:22:58 am by OnTheCuttingEdge »

onthecuttingedge2005

  • Guest
Re: Conversational rules A.I
« Reply #7 on: December 31, 2017, 12:38:33 am »
Translated the VB.Net code to Classical VBScript.

Spitfire2600

  • Sr. Member
  • ****
  • Posts: 251
    • View Profile
Re: Conversational rules A.I
« Reply #8 on: January 05, 2018, 12:53:16 am »
Brilliant!

I just plugged it in and I already notice a positive difference.
Well done man!

- Spitfire