here is another of his (Bill Dewitts" plug ins called "learn from the news" i tried this one to didn't get any errors but all it would do is say "i have indexed items or news? " Rem Type=Plugin
Rem Name= Learn From News
Rem Author= Bill DeWitt
Rem Host=Assistant
'-----------------------------------------------------------------
'This sub sets up the plug-ins option panel in Hal's options dialog
'-----------------------------------------------------------------
Sub OptionsPanel()
lblPlugin(0).Caption = "Say - Check the News"
lblPlugin(0).Move 120, 120, 3300, 1200
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub
Rem PLUGIN: PLUGINAREA7
HalBrain.ReadOnlyMode = False
If InStr(1,OriginalSentence, "check the news",1) Then
Dim objXMLNews
Dim NewsArray()
set objXMLNews = CreateObject("Msxml2.DomDocument.4.0")
objXMLNews.async = False
objXMLNews.ValidateOnParse = false
objXMLNews.load("
http://www.foxnews.com/xmlfeed/rss/0,4313,81,00.rss")
'objXMLNews.load("
http://www.csmonitor.com/rss/top.rss")
'objXMLNews.load("
http://www.weather.gov/data/current_obs/KVSF.rss")
'objXMLNews.load("
http://www.weather.gov/data/current_obs/KVSF.xml")
Dim xmlNodeNews
set xmlNodeNews = objXMLNews.documentElement.selectNodes("//item")
Dim xmlNewsItem
dim strResult
For Each xmlNewsItem In xmlNodeNews
CountNews = CountNews+1
Next
ReDim NewsArray(CountNews-1)
For Each xmlNewsItem In xmlNodeNews
Randomize
MakeEntry(xmlNewsItem.selectSingleNode("description").Text)
Index = Index+1
Next
GetResponse = "I have indexed " & CStr(Index) & " News items."
End If
Rem PLUGIN: FUNCTIONS
Function MakeEntry(NewsItem)
'SAVE: AUTO TOPIC FOCUS LEARNING
If HalBrain.ReadOnlyMode = False And HalGreeting = "" And PersonalData = False And HalBrain.CountInstances(" ", Trim(UserSentence)) > 2 And IsQuestion = False Then
Keywords = HalBrain.TopicSearch(NewsItem, "topicRelationships") & " " & CurrentSubject & " " & NewsItem
Keywords = HalBrain.RemoveExtraSpaces(HalBrain.ExtractKeywords(" " & Keywords & " "))
If Len(Keywords) > 3 Then
KeywordList = Split(Keywords, " ")
TopicList = ""
'Create list of tables that exist for each keyword
For i = LBound(KeywordList) To UBound(KeywordList)
TopicTable = HalBrain.TopicSearch(" " & KeywordList(i) & " ", "topicRelationships")
If TopicTable <> "" And InStr(1, " " & TopicList, " " & Trim(TopicTable) & " ", vbTextCompare) = 0 Then
'Topic already exists, make note of it
TopicList = TopicList & TopicTable & " "
ElseIf TopicTable = "" Then
If Asc(Left(KeywordList(i),1)) > 47 And Asc(Left(KeywordList(i),1)) < 58 Or HalBrain.Word2Num(KeywordList(i)) <> "X" Then IsNumber = True Else IsNumber = False
If WN.LookupWord(KeywordList(i)) = True And WN.GuessPartOfSpeech() = "NOUN" And IsNumber = False Then
'Topic does not exist, but can and will be created
TopicList = TopicList & KeywordList(i) & " "
HalBrain.CreateTable "_" & Trim(LCase(KeywordList(i))), "Brain", "autoLearningBrain"
HalBrain.AddToTable "topicRelationships", "TopicSearch", " " & Trim(KeywordList(i)) & " ", Trim(LCase(KeywordList(i)))
'Relationships based on wordnet synonyms are recorded
Relationships = WN.GetDefinition("NOUN", 1, "S") & "," & WN.GetSynonyms("NOUN", 1)
Relationships = Replace(Relationships, ", ", ",")
Relationships = Trim(Replace(Relationships, ",,", ","))
If Right(Relationships, 1) = "," Then Relationships = Trim(Left(Relationships, Len(Relationships) - 1))
If Len(Relationships) > 1 Then
If Left(Relationships, 1) = "," Then Relationships = Right(Relationships, Len(Relationships) - 1)
RelList = Split(Relationships, ",")
For h = LBound(RelList) To UBound(RelList)
If HalBrain.TopicSearch(" " & RelList(h) & " ", "topicRelationships") = "" Then
HalBrain.AddToTable "topicRelationships", "TopicSearch", " " & Trim(RelList(h)) & " ", Trim(LCase(KeywordList(i)))
End If
Next
End If
End If
End If
Next
'User's sentence is recorded in all related topic tables
TopicList = HalBrain.RemoveExtraSpaces(TopicList)
If TopicList <> "" Then
AlreadyLearned = True
TableList = Split(TopicList, " ")
For i = LBound(TableList) To UBound(TableList)
If TopicContinuity = True Then HalBrain.AddToTable "_" & Trim(LCase(TableList(i))), "Brain", Trim(HalBrain.AlphaNumericalOnly(PrevSent)), AnswerSent
HalBrain.AddToTable "_" & Trim(LCase(TableList(i))), "Brain", Trim(NewsItem), AnswerSent
Next
End If
End If
End If
End Function