Zabaware Support Forums

Zabaware Forums => Ultra Hal Assistant File Sharing Area => Topic started by: Andre Hendriks on October 17, 2016, 03:37:01 am

Title: WolframAlpha plug-in with a few commands added another few commands
Post by: Andre Hendriks on October 17, 2016, 03:37:01 am
with some credits to the people whom wrote the google.uhp plug-in wich I used as example.

Rem Type=Plugin
Rem Name=wolframalpha
Rem Author=Andre Hendriks
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "Hal will open your browser and enter a wolframalpha query if you use the keywords 'compute', 'Standard Deviation', 'calculate', or 'bar chart' in a sentence."
    lblPlugin(0).Move 120, 120, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

    Rem PLUGIN: PLUGINAREA1
    'The comment above tells Ultra Hal Assistant to insert the following code
    'on-the-fly into the main brain code in the section referenced.
    SearchEngine = "http://www.wolframalpha.com/input/?i="
    If InStr(1, UserSentence, "Standard Deviation ", 1) > 0 Or InStr(1, UserSentence, "compute ", 1) > 0 Or InStr(1, UserSentence, "bar chart", 1) > 0 Or InStr(1, UserSentence, "calculate ", 1) > 0 Then
        SearchKeywords = LCase(Replace(Trim(HalBrain.AlphaNumericalOnly(HalBrain.ExtractKeywords(UserSentence))), " ", "+"))
        SearchKeyWords = Replace(SearchKeywords, "compute+", "")
        SearchKeyWords = Replace(SearchKeywords, "bar chart+", "")
        SearchKeyWords = Replace(SearchKeywords, "calculate+", "")
        SearchKeyWords = Replace(SearchKeywords, "Standard Deviation+", "")
        HalCommands = HalCommands & "<RUNPROG>" & SearchEngine & SearchKeywords & "</RUNPROG>"
        GetResponse = GetResponse & "I will help you research this topic on the Internet. "
    End If



an update

Rem Type=Plugin
Rem Name=wolframalpha
Rem Author=Andre Hendriks
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "Hal will open your browser and enter a wolframalpha query if you use the keywords 'compute', 'solve', 'formula', 'mean', 'median', 'çommonest element',  'Standard Deviation', 'variance', 'first quartile', 'third quartile', 'interquartile range', 'calculate', 'bar chart', 'histogram', or 'scatter plot'   in a sentence."
    lblPlugin(0).Move 120, 120, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

    Rem PLUGIN: PLUGINAREA1
    'The comment above tells Ultra Hal Assistant to insert the following code
    'on-the-fly into the main brain code in the section referenced.
    SearchEngine = "http://www.wolframalpha.com/input/?i="
    If InStr(1, UserSentence, "Standard Deviation", 1) > 0 Or InStr(1, UserSentence, "solve", 1) > 0 Or InStr(1, UserSentence, "formula", 1) > 0 Or InStr(1, UserSentence, "mean", 1) > 0 Or InStr(1, UserSentence, "median", 1) > 0 Or InStr(1, UserSentence, "commonest element", 1) > 0 Or InStr(1, UserSentence, "variance", 1) > 0 Or InStr(1, UserSentence, "first quartile", 1) > 0 Or InStr(1, UserSentence, "third quartile", 1) > 0 Or InStr(1, UserSentence, "interquartile range", 1) > 0 Or InStr(1, UserSentence, "compute", 1) > 0 Or InStr(1, UserSentence, "bar chart", 1) > 0 Or InStr(1, UserSentence, "histogram", 1) > 0 Or InStr(1, UserSentence, "scatter plot", 1) > 0 Or InStr(1, UserSentence, "calculate", 1) > 0 Then
        SearchKeywords = LCase(Replace(Trim(HalBrain.AlphaNumericalOnly(HalBrain.ExtractKeywords(UserSentence))), "", "+"))
        SearchKeyWords = Replace(SearchKeywords, "compute+", "")
   SearchKeyWords = Replace(SearchKeywords, "solve+", "")
   SearchKeyWords = Replace(SearchKeywords, "formula+", "")
        SearchKeyWords = Replace(SearchKeywords, "bar chart+", "")
   SearchKeyWords = Replace(SearchKeywords, "histogram+", "")
   SearchKeyWords = Replace(SearchKeywords, "scatter plot+", "")
        SearchKeyWords = Replace(SearchKeywords, "calculate+", "")
   SearchKeyWords = Replace(SearchKeywords, "mean+", "")
   SearchKeyWords = Replace(SearchKeywords, "median+", "")
   SearchKeyWords = Replace(SearchKeywords, "commonest element+", "")
        SearchKeyWords = Replace(SearchKeywords, "Standard Deviation+", "")
   SearchKeyWords = Replace(SearchKeywords, "variance+", "")
   SearchKeyWords = Replace(SearchKeywords, "first quartile+", "")
   SearchKeyWords = Replace(SearchKeywords, "third quartile+", "")
   SearchKeyWords = Replace(SearchKeywords, "interquartile range+", "")
        HalCommands = HalCommands & "<RUNPROG>" & SearchEngine & SearchKeywords & "</RUNPROG>"
        GetResponse = GetResponse & "I will help you research this topic on the Internet. "
    End If



again an update the searchkeyword mean is calculating the general in statistics while it only supposed to calculate the mean I added the general there for.
I noticed that the Mean command needs {dataset} so it gets example: Mean{3 4 6 8 23 56 78 34 54 65}


Rem Type=Plugin
Rem Name=wolframalpha website
Rem Author=Andre Hendriks
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
    lblPlugin(0).Caption = "Hal will open your browser and enter a wolframalpha query if you use the keywords 'Compute', 'Solve', 'Formula', 'General', 'Mean', 'Median', 'Commonest Element',  'Standard Deviation', 'Variance', 'First Quartile', 'Third Quartile', 'Interquartile Range', 'Calculate', 'Bar Chart', 'Histogram', or 'Scatter Plot'   in a sentence."
    lblPlugin(0).Move 120, 120, 3300, 1000
    lblPlugin(0).WordWrap = True
    lblPlugin(0).Visible = True
End Sub

    Rem PLUGIN: PLUGINAREA1
    'The comment above tells Ultra Hal Assistant to insert the following code
    'on-the-fly into the main brain code in the section referenced.
    SearchEngine = "http://www.wolframalpha.com/input/?i="
    If InStr(1, UserSentence, "Standard Deviation", 1) > 0 Or InStr(1, UserSentence, "General", 1) > 0 Or InStr(1, UserSentence, "Solve", 1) > 0 Or InStr(1, UserSentence, "Formula", 1) > 0 Or InStr(1, UserSentence, "Mean", 1) > 0 Or InStr(1, UserSentence, "Median", 1) > 0 Or InStr(1, UserSentence, "Commonest Element", 1) > 0 Or InStr(1, UserSentence, "Variance", 1) > 0 Or InStr(1, UserSentence, "First Quartile", 1) > 0 Or InStr(1, UserSentence, "Third Quartile", 1) > 0 Or InStr(1, UserSentence, "Interquartile Range", 1) > 0 Or InStr(1, UserSentence, "Compute", 1) > 0 Or InStr(1, UserSentence, "Bar Chart", 1) > 0 Or InStr(1, UserSentence, "Histogram", 1) > 0 Or InStr(1, UserSentence, "Scatter Plot", 1) > 0 Or InStr(1, UserSentence, "Calculate", 1) > 0 Then
        SearchKeywords = LCase(Replace(Trim(HalBrain.AlphaNumericalOnly(HalBrain.ExtractKeywords(UserSentence))), "", "+"))
        SearchKeyWords = Replace(SearchKeywords, "Compute+", "")
   SearchKeyWords = Replace(SearchKeywords, "Solve+", "")
   SearchKeyWords = Replace(SearchKeywords, "Formula+", "")
        SearchKeyWords = Replace(SearchKeywords, "Bar Chart+", "")
   SearchKeyWords = Replace(SearchKeywords, "Histogram+", "")
   SearchKeyWords = Replace(SearchKeywords, "Scatter Plot+", "")
        SearchKeyWords = Replace(SearchKeywords, "Calculate+", "")
   SearchKeyWords = Replace(SearchKeywords, "General+", "")
   SearchKeyWords = Replace(SearchKeywords, "Mean+", "")
   SearchKeyWords = Replace(SearchKeywords, "Median+", "")
   SearchKeyWords = Replace(SearchKeywords, "Commonest Element+", "")
        SearchKeyWords = Replace(SearchKeywords, "Standard Deviation+", "")
   SearchKeyWords = Replace(SearchKeywords, "Variance+", "")
   SearchKeyWords = Replace(SearchKeywords, "First Quartile+", "")
   SearchKeyWords = Replace(SearchKeywords, "Third Quartile+", "")
   SearchKeyWords = Replace(SearchKeywords, "Interquartile Range+", "")
        HalCommands = HalCommands & "<RUNPROG>" & SearchEngine & SearchKeywords & "</RUNPROG>"
        GetResponse = GetResponse & "I will help you research this topic on the Internet. "
    End If
Title: Re: WolframAlpha plug-in with a few commands added another few commands
Post by: Spitfire2600 on October 24, 2016, 07:01:56 pm
This seems pretty useful! Thanks!

- Spitfire
Title: Re: WolframAlpha plug-in with a few commands added another few commands
Post by: Art on October 26, 2016, 04:35:05 pm
Nice work but it would really be helpful if you could assign a revision / release indicator for each plugin like an appended date (09-13-2016) or wolframalpha-1 or -2 or -A, -B, etc.

Sometimes file size isn't always a reliable indicator.

Nice work and hopefully we'll see some more of your efforts! Thanks!
Title: Re: WolframAlpha plug-in with a few commands added another few commands
Post by: DayWalker on November 06, 2016, 12:26:10 pm
I too use the "Google plugin" works good but could use some refinement. I agree, which one is the one we need to use OR the updated one?
Title: Re: WolframAlpha plug-in with a few commands added another few commands
Post by: Andre Hendriks on November 07, 2016, 01:26:06 am
you would need the one off 2,95 kb that is the last one I uploaded.
Title: Re: WolframAlpha plug-in with a few commands added another few commands
Post by: DayWalker on November 07, 2016, 07:15:25 pm
Thank you!