artificial intelegence communiceren

Status
Niet open voor verdere reacties.

christian1122

Gebruiker
Lid geworden
7 nov 2011
Berichten
32
ik ben een soort van alice/cleverbot aan het maken en was de manual van cleverbot aan het lezen
ik zag iets wat ik ook wil doen in visual basic maar ik weet alleen de code niet
wat ik nu heb is
if textbox2.text.contains "hello" then
richtextbox1.text = richtextbox1.text & "bot: " "hello"
end if

dat soort standaard dingen dus
maar wat ik dus wil is zoiets als dit:

Accuracy
column determines how accurate your prediction needs to be. If you set the accuracy
of the input to 100%, then only the exact word “hello” would match. If you set it to something
really low like 20% then all sorts of things, like “heeeeelelllllloooo” would also match. 75% allows
for some typos and mistakes so “helloo” would also match. Note that upper and lower case and any
punctuation marks at the end are ignored when making string comparisons.
The 0% on the second input means it will match anything else. So anything not 75% similar to
“hello” will Goto the output labelled sorry

al die labels enzo mag je wegdenken het gaat me om het matchen van antwoorden
dat hellloo bijv ook gezien word als hello en je dus hetzelfde antwoord krijgt
weet iemand daar een code voor i visual basic?
 
Wat ik persoonlijk zou doen (om het simpel te houden) is een string maken met alle woorden die je wilt onder hello:

Dim hellowords as string = "hello, helo, hleo, hi,hey,hiy,hallo"

en dan een methode om te kijken of hoi is gezecht.

Dan krijg je dus sowiest:
[CPP] Dim hellowords As String = "hello, helo, hleo, hi,hey,hiy,hallo"

Public Function checkforhello(ByVal text As String)
Dim strArray As String() = hellowords.Split(",")
For Each s In strArray
If s.Contains(text) Or s.Equals(text) Then
Return True
End If
Next
Return False
End Function

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If checkforhello(TextBox1.Text) Then
MsgBox("HALLO!")
End If
End Sub[/CPP]

De code:
Bekijk bijlage WindowsApplication1.rar
 
Als je een echt uitgebreid systeem wil maken, zul je gebruik moeten maken van een database waar berichten/antwoorden naast elkaar opgeslagen worden.
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan