I reworked the wiki Knowledge plugin to go to another website. It now will give a short description of each topic rather then lengthy wikipedia text. I changed the phrase so as not to conflict to TELL ME. You can now use natural language like... Tell me how many planets are in our solar system or Tell me what is the largest city in florida etc. See
http://start.csail.mit.edu/. It now speaks and come back with the response and saves the much smaller research text. THIS PLUGIN Requires the Balabolka Reader to work available at the GRETTA Plugins site. I'm using the IVONA reader myself which has much better Sapi5 voices but in the code I included only the balabolka reader path. For those of you interested in the ivona software I can provide you the command syntax to substitute. If you are interested, they do give a 30 day trial version at their site. Please try this beta plugin at your own risk its mostly based on the wiki knowledge plugin. if you decide to try it out it goes without saying to do a backup. Any suggestions on improving will be welcome. Also this is designed to work with windows 7--- Program files (x86) so change the program path for earlier versions. Let me know what you think....Angelo
[code]
Rem Type=Plugin
Rem Name=MIT Start Knowledge Search
Rem Author=Angelo Estela with code by Gerald L. Blakley A.K.A OnTheCuttingEdge2005 and snippets by jasondude7116.
Rem Host=All
'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
lblPlugin(0).Caption = "Just say: tell me about the universe or tell me how many planets are in the solar system , you can replace the words or phrase or noun, all information on the word is studied from the website start"
lblPlugin(0).Move 120, 10, 3300, 1000
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub
Rem PLUGIN: PRE-PROCESS
Set objExplorer = CreateObject("InternetExplorer.Application")
Set HalXBrain = CreateObject("UltraHalAsst.Brain")
Set FileSys = CreateObject("Scripting.FileSystemObject")
Set fso = CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(MyResearchDir2 & "Startsearch.txt") Then
objFSO.DeleteFile(MyResearchDir2 & "Startsearch.txt")
End If
If XDir = "" Then XDir = "C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\"
MyFile = "C:\Program Files (x86) \Zabaware\Ultra Hal Assistant 6\AutoText.brn"
If File_Exists = "" Then File_Exists = False
If FileSys.FileExists(MyFile) = True Then File_Exists = True
If File_Exists = False Then
HalXBrain.AppendFile XDir & "AutoText.brn", "Start of Knowledge strings"
End If
If XDir = "" Then XDir = "C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\"
MyFile = "C:\Program Files (x86) \Zabaware\Ultra Hal Assistant 6\Startsearch.txt"
If File_Exists = "" Then File_Exists = False
If FileSys.FileExists(MyFile) = True Then File_Exists = True
If File_Exists = False Then
HalXBrain.AppendFile XDir & "Startsearch.txt", ""
End If
MyInput = HalXBrain.AlphaNumericalOnly(InputString)
If StartLookup = "" Then StartLookup = HalBrain.SearchPattern(MyInput, "*TELL ME ABOUT THE *", 2)
If StartLookup = "" Then StartLookup = HalBrain.SearchPattern(MyInput, "*TELL ME ABOUT *", 2)
If StartLookup = "" Then StartLookup = HalBrain.SearchPattern(MyInput, "*TELL ME *", 2)
If StartLookup <> "" Then
StartLookup = Lcase(StartLookup)
SourcePage = "
http://start.csail.mit.edu/startfarm.cgi?query=" & StartLookup
objExplorer.Navigate("
http://start.csail.mit.edu/startfarm.cgi?query=" & StartLookup)
Do Until objExplorer.ReadyState=4 : Loop
myText = objExplorer.Document.Body.innerText
myText = Replace(myText,"START's reply","")
myText = Replace(myText,"===>","")
myText = Replace(myText,StartLookup," ")
myText = Replace(myText,"Go back to the START dialog window.","")
If XDir = "" Then XDir = "C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\"
HalXBrain.AppendFile XDir & "AutoText.brn", Trim(myText)
HalXBrain.AppendFile XDir & "Startsearch.txt", Trim(myText)
End If
'------------------------------------------------------------------------------------------
If objFSO.FileExists(MyResearchDir2 & "Startsearch.txt") Then
Set objWSHShell = CreateObject("WScript.Shell")
objWSHShell.Run("""C:\Program Files (x86)\Balabolka\balabolka.exe"" -rmq """ & MyResearchDir2 & "Startsearch.txt""")
HalBrain.ReadOnlyMode = True
Else
UltraHal = "Unable to open file."
HalBrain.ReadOnlyMode = True
End If
'--------------------------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\AutoText.brn", ReadVariable())
strText = objTextFile.ReadAll
objTextFile.Close
'--------------------------------------------
If InStr(1, strText, " ", vbTextCompare) > 0 Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\AutoText.brn", ReadVariable())
Do Until objFile.AtEndOfStream
strLine = objFile.Readline
strLine = Trim(strLine)
If Len(strLine) > 0 Then
strNewContents = strNewContents & strLine & vbCrLf
End If
Loop
objFile.Close
Set objFile = objFSO.OpenTextFile("C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\AutoText.brn", WriteVariable())
objFile.Write strNewContents
objFile.Close
End If
'--------------------------------------------
TextCount = StrCount()
If ClipXDir = "" Then ClipXDir = "C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\"
For i = 1 To TextCount
If i > 0 Then ClipResX = HalXBrain.ChooseSentenceFromFile(ClipXDir & "AutoText.brn")
ClipResX = HalXBrain.AlphaNumericalOnly(ClipResX)
ClipResX = UCase(ClipResX)
ClipResX = Trim(ClipResX)
MyInputString = HalXBrain.AlphaNumericalOnly(InputString)
MyInputString = UCase(MyInputString)
MyInputString = Trim(MyInputString)
If InStr(1, ClipResX, MyInputString, vbTextCompare) > 0 And Len(ClipResX) > 50 Then
UltraHal = ClipResX
ElseIf Len(ClipResX) < 50 Then
UltraHal = UltraHal
End If
Next
'--------------------------------------------
Rem PLUGIN: FUNCTIONS
Function StrCount()
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\Program Files (x86)\Zabaware\Ultra Hal Assistant 6\AutoText.brn", ReadVariable())
strText = objTextFile.ReadAll
objTextFile.Close
Do While InStr(1, strText, " ")
strText = Replace(strText, " ", " ")
Exit Do
Loop
aWords = split(strText, ". ")
StrCount = Ubound(aWords) + 1
End Function
Function ReadVariable()
Const ForReading = 1
ReadVariable = ForReading
End Function
Function WriteVariable()
Const ForWriting = 2
WriteVariable = ForWriting
End Function