dupa

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - lanman

Pages: [1]
1
Ultra Hal 7.0 / what to do about hyphens , other characters ?
« on: January 03, 2004, 06:04:17 pm »
Okay, I did enough to answer my own original question. By editting the mywebhal.uhp script I was able to get a web-search to focus on my literal string rather than being subject to the HalBrain.ExtractKeywords(UserSentence) processing that removed my hyphen and kind of messes around with the search string.

First off, you do need to set up a webhal account with Zabaware which is how you specify your search engine choice like "google". Originally, I set it up and requested that Hal

> find t-vec

where "t-vec" is the name of the company that I work for. Before modification, the GetResponse() function in mywebhal.uhp did the following

           Keywords = Replace(Trim(HalBrain.AlphaNumericalOnly(HalBrain.ExtractKeywords(UserSentence))), " ", "+")
           GetResponse = "I will help you research this topic on the Internet.<RUN>http://www.zabaware.com/mywebhal/index.html?username=" & UserName & "&action=search&keywords=" & Keywords & "&char=" & FacePrvw & "</RUN>"

You can see that the "-" character probably gets removed by the HalBrain.AlphaNumericalOnly() function. But since "t-vec" is a proper name the search string "tvec" is no good at all. So I modified the script as follows


           quote_position = InStr(1, UserSentence, Chr(34), 1)
           If quote_position > 0 Then
             Keywords = Right(UserSentence, len(UserSentence) + quote_position)
           Else
             Set HalBrain = CreateObject("UltraHalAsst.Brain")
             Keywords = Replace(Trim(HalBrain.AlphaNumericalOnly(HalBrain.ExtractKeywords(UserSentence))), " ", "+")
           End If
           GetResponse = "I will help you research this topic on the Internet.<RUN>http://www.zabaware.com/mywebhal/index.html?username=" & UserName & "&action=search&keywords=" & Keywords & "&char=" & FacePrvw & "</RUN>"

I set it up so that if I issued the hal command

> find "t-vec"

the the exact string "t-vec" gets used as the bases of Keywords which gets submitted to google. If I don't use quotes around the search target, the original processing gets used.

I also made a few other changes to the script to make it more efficient, such as using ElseIF statements rather then If statements where the cases are mutually exclusive. But what I need to figure out now is how to pass quote characters as part of the google search string (Keywords). Right now, they are apparently being stripped out by the

<RUN>http://www.zabaware.com/mywebhal/index.html?username=" & UserName & "&action=search&keywords=" & Keywords & "&char=" & FacePrvw & "</RUN>

command. Even if I explicitly add them right before this command by doing something like

Keywords = Chr(34) & Keywords & Chr(34)

Does anyone know how I might be able to accomplish that. Quote characters tell google to match the exact string between the quote characters, rather than treat them as independent search words.

I also tried using the URL encoding approach "%23" (an escaped hexidecimal code for the " character) but it appears that the processing down by the Hal command <RUN>url spec</RUN> is filtering out the " characters.

Web-search functionality could be greatly enhanced by providing a way for un-adulterated search strings to be passed directly to a search engine without.

2
Ultra Hal 7.0 / what to do about hyphens , other characters ?
« on: January 03, 2004, 01:43:24 pm »
Okay Don. I'd be happy to. So far, I haven't done much worth talking about. Just some experimentation with the default capabilities. But, being a software engineer, and always looking for ways to automate things, I'll get around to making improvements to the default operation eventually ;-).


3
Ultra Hal 7.0 / what to do about hyphens , other characters ?
« on: January 02, 2004, 05:38:35 pm »
OK, Thanks Don. Actually, I didn't look closely as to whether the lines I was talking about were removing or replacing punctuation. I just pointed them out because they were indications that punctuation was being removed or manipulated in some way.

I had not yet tried customizing anything, but was trying to use the current built in support for using HAL to access search engines and found that it didn't appear easy or even possible (without customization) to get HAL to actually invoke a google search with the exact string you wanted searched for.

Anyway, thanks for your response. It does provide me with a direction ;-)


4
Ultra Hal 7.0 / what to do about hyphens , other characters ?
« on: December 28, 2003, 03:35:02 pm »
I'm a new user of Hal and I'm trying to explore its potential as an assistant. I'm having troubles that involve the fact that Hal seems to remove all punctuation characters via statements like

   
   UserSentence = Replace("" & UserSentence & "", ";", " VSZ ", 1, -1, vbTextCompare)
   UserSentence = Replace("" & UserSentence & "", ":", " VMZ ", 1, -1, vbTextCompare)
   UserSentence = Replace("" & UserSentence & "", ", ", " VCZ ", 1, -1, vbTextCompare)


and

   'PROCESS: REMOVE PUNCTUATION
   'This function removes all punctuation and
   'symbols from the User's sentence so they won't
   'confuse Hal during processing.
   UserSentence = HalBrain.AlphaNumericalOnly(UserSentence)

One of the problems I'm experiencing is when I'm asking Hal to search for information on the web via google where a hyphen character in the name of the topic I'm inquiring about is significant. I tried commenting out the line

UserSentence = Replace("" & UserSentence & "", "-", " VHZ ", 1, -1, vbTextCompare)

from the brain I was using, but this didn't help.

Can anyone tell me how to make Hal take a query topic more literally, not removing characters like hyphens from the topic of the search ?

Pages: [1]