Zabaware Forums > General Discussion

the halBRAIN.DLL

<< < (2/2)

spydaz:
when adding the database i used DAO controls uses WIN97 DATABASE, so i work in office XP the convert the file  keeping the original for updating...


Function SQLsearch_QAKB(ByVal F_QUESTION, ByRef F_ANSWER, ByRef rsplogic)

  Dim MYSQL As String
  Dim SQLCOUNT As String
  Dim i As Integer
  On Error GoTo HANDLEERRORS
  MYSQL = "Select QA_KB.ANSWER From QA_KB Where (QA_KB.QUESTION = '" & F_QUESTION & "' )"
 
  'QUERY DATABASE
  BASE.db_qakb.RecordSource = MYSQL
  BASE.db_qakb.Refresh
 
  ' GET RECORD COUNT
  BASE.db_qakb.Recordset.MoveLast
  BASE.db_qakb.Recordset.MoveFirst
  SQLCOUNT = BASE.db_qakb.Recordset.RecordCount
 
  'PICK RANDOM RECORD
  SQLCOUNT = Int((SQLCOUNT * Rnd) + 1)

  For i = 1 To SQLCOUNT - 1
    BASE.db_qakb.Recordset.MoveNext
  Next

  rsplogic = True
 
  F_ANSWER = BASE.LBL_KB_ANSWER.Caption
HANDLEERRORS:
 
 
  Exit Function

a typical search function


Function HALMATH(ByRef usersentence, ByRef getresponse, ByRef rsplogic)
Dim HALBRAIN As New Brain
Dim WN As New WordNet

'RESPOND: CALL MATH FUNCTION
    'This function from the DLL answers simple math questions, whether written out in words or with numerals.
    'If an answer is found, it overrides everything before this function.
   
    HALMATH = HALBRAIN.HALMATH(usersentence) & vbCrLf
   
    If Len(HALMATH) > 3 Then
        getresponse = HALMATH & vbCrLf
        rsplogic = True
    End If


End Function

a typically converted script



FuzzieDice:
Coolbeans. Thanks. :) I'll have to browse and work with those functions some day when/if I ever get time. Looks interesting.

Navigation

[0] Message Index

[*] Previous page

Go to full version