AI Zone Admin Forum Add your forum
javascript and text-to-speech
 
 

Hi,

Our library is working in partnership with the Akron-Summit County Public Library to develop a chatbot to answer FAQs and reference questions for our patrons. Using some javascript, the bot will now search for newspaper and journal articles and open a new window with the results:

<category>
<
pattern>ARTICLES ON *</pattern
<
template>Please turn off your pop-up blocker to see the results of this searchExcuse me a moment while I lookDon't mind if I talk to myself a little.
[removed]var myWindow =window.open('
http://ohioweblibrary.org/?q=<star/>');[removed]</template>
</category

We’re using a SitePl avatar and the text-to-speech reads everything unless it’s inside carrots, <>. Do any of you know how we could get the TTS to *not* read the javascript?
If you’d like to see this in action, here’s our bot: http://www.mentorpl.org/catbot.html.

Thanks,

David Newyear
Mentor Public Library

 

 
  [ # 1 ]

Hi David,
Welcome to the Chatbots.org forums!

Nice word, catbot grin. Why did you chose a cat instead of a human?

Do you have plan to keep this chatbot and to extend it? We can also include in the directory on our homepage. Check these guidelines if you’re interested:
http://www.chatbots.org/directory/static/add_your_chatbots/

 

 
  [ # 2 ]

You may wish to try a “trick” that was used in the past that caused older browsers (I.E. 3.0) to ignore javascript. It simply entails placing all code within an HTML comment tag, like this:

script type="text/javascript"><!-- var myWindow =window.open(‘http://ohioweblibrary.org/?q=<star/ >’); -->< /script> 

It may or may not work, but it’s certainly worth a try.

@Erwin

Two things, please:

1.) when clicking “Advanced Reply”, any contents that had already been placed in the text area should be transferred to the new text area in the advanced form, and they are not.
2.) Drat! I forgot what 2 was. I’ll have to write notes, next time.  shut eye

 

 
  [ # 3 ]

Hi David,

You can also move all your javascript code to a separate file and include it into your HTML. The javascript functions can still be invoked using the various event attributes of the HTML tags, so there won’t be anything outside of the angle brackets to be “spoken” by your text to speech software.

<html>
<
head>
...
<
script type="text/javascript" src="chatbot.js"/>
...
</
head>
<
body onload="main();">
...
</
body>
</
html

Cheers,
Andrew Smith
<http://asmith.id.au>
<http://wixml.net>

 

 
  [ # 4 ]

Testing listed below seems to indicate the issue has been resolved:

<html><head>
<
link rel="stylesheet" title="default" href="/botmaster/common/default.css" type="text/css">
<
script>
<!--
function 
sf(){document.f.input.focus();}
// -->
</script>
</head><body onload="sf()" lang="en-US" bgcolor="#aaaaaa">
<
script language="javascript"
function 
sayit() {
  
if (parent.vhost{
    
if (parent.vhost.vhostLoaded{
      parent
.vhost.vhostSpeaking=true;
      
parent.vhost.sayText("Try looking in our catalog for articles on cats.",3,1,3);

    
else {
      setTimeout
("sayit()"500);
    
}
  }
}
sayit
();
</script>
<br><br>
<
b>You said:</b[i]Do you have any articles on cats?[/i]<br>
<
b>Emma:</b[i]Try looking in our <a href="http://catalog.mentorpl.org[/i]" target="_blank"><bcatalog</b></a> for  articles on cats.<br>
<
br>
<
form name="f" action="" method="post">
<
input name="(intentionally not shown)" value="(intentionally not shown)" type="hidden"
<
p><font face="arial"><b>You say:</b></font
<
input size="50" name="input"
<
input value="Say" type="submit">
</
p>
</
form>
</
body></html

Solution Possibility: (please confirm)

<category>
<
pattern>ARTICLES ON *</pattern>
<
template>Please turn off your pop-up blocker to see the results of this searchExcuse me a moment while I lookDon’t mind if I talk to myself a little.
<!
[CDATA[><a target=“_new”  href=“http://ohioweblibrary.org/?q=<star∕>”>]]>  Go to my website! <![CDATA[><∕a>]]>
</template>
</
category
 

 
  [ # 5 ]

@Dave: http://www.chatbots.org/admin/viewthread/216/
Furthermore: I’ve added some [ code ] tags to this thread

 

 
  [ # 6 ]

Hi all,

I’m Michele McNeal who’s working on the Akron end of the chatbot project.  I tried simple commenting out (<!——>) as well as the <![CDATA[> approach, but the javascript is still being read aloud. 

I’m going to try placing the javascript outside the aiml files, but the problem then becomes passing the <star> value to that exterior script.

Thanks to all for your help on this!

 

 
  [ # 7 ]

Hi Michele,

Assuming that placing the javascript in a separate file does prevent it from being read aloud, you should still be able to use the document object model (DOM) functions to access the document as XML, thus retrieving the star value. Although I haven’t done this sort of thing with AIML I have done things like this very successfully with other kinds of XML.

Cheers,
Andrew Smith

 

 
  [ # 8 ]

Hi, Michele, and welcome!

@David and Michele:

What AIML interpreters are you folks using as a basis for your chatbots? Depending on which is used, there may be a couple of solutions available to help here. I’ll outline them here, below:

The first possible solution is to use the <system> tag to encapsulate any responses requiring Javascript, and creating a specific function to transform the encapsulated response into it’s desired final form. An example follows:

<category>
<
pattern>ARTICLES ON *</pattern
<
template>Please turn off your pop-up blocker to see the results of this searchExcuse me a moment while I lookDon't mind if I talk to myself a little.
<system>popupSearch(<star/>)</system></template>
</category>

{javascript function}

function popupSearch(query) {
  var URL = "http://ohioweblibrary.org/?q=" + query;
  var options = "location=0,toolbar=0,status=0"; // Customize the popup'
s appearance
  
var myWindow window.open(urloptions);

(Please note that this code is intended as an example only, and not suitable for direct usage.)

With this method, some interpreters will require an intermediate function within the interpreter’s language, to form a “bridge” between the interpreter and the output. As there are numerous ways that this is accomplished that vary with the specific interpreter used, I’ll leave this “as-is” for now, until I have more information.


The second method that may prove useful is the creation of custom tags, to more or less do the same thing that I just outlined. The only substantive difference is that, instead of using the <system> tag, you’re creating a new set of tags, along with new custom functionality, within the interpreter itself. This is a LOT more work, but there are certain benefits, as well (the <system> tag is, under the right set of circumstances, vulnerable to mischief). I’ve used this method in the creation of my chatbot, Morti, for his Google, Wiki and Search commands.

 

 
  [ # 9 ]

Well Michele,

You may patch it with regular expressions or built-in string replace functions
on the first parent.vhost.sayText function argument, but customizing like that should be considered as a last resort.

As I mentioned, I tested the link you provided by asking “Do you have any articles on cats?“and then I copy and pasted the results.  The interesting part of the output shows plain text in the first function argument:

parent.vhost.sayText("Try looking in our catalog for articles on cats.",3,1,3); 

and an HTML markup on the “catalog” link in the page output:

<b>Emma:</b
Try 
looking in our <a href="http://catalog.mentorpl.org" target="_blank">
<
bcatalog</b></a> for  articles on cats.<br

which appears to be working correctly.  Is it possible to compare why this is working against that which is not working yet?

Lastly, no conclusions are being drawn, I am simply reporting the results I had as feedback.  Tentatively speaking, it appears that in some instances your system is functioning properly.

 

 
  [ # 10 ]

Our aiml interpreter is program Z. (Thank you for your help with this).

 

 
  [ # 11 ]

Since Program Z seems to be the proprietary software that’s used on pandorabots.com, am I to assume that the bot in question is hosted there? Because if so, then the best person to answer your questions is Dr. Richard Wallace, who is CTO there. He also created the ALICE chatbot, and had a great deal of influence in the creation of AIML. Also, as Program Z is written in LISP, and since I have less experience with that language than I do with the theoretical existence of the Higgs Boson, I’m probably not the person who can best assist you at this point. We all have our strengths and weaknesses, and this is one of my latters. downer

 

 
  [ # 12 ]

Hi David,

I agree with Dave Morton that Dr Wallace would be the best person to approach about fixing any issues that you are having with Program Z. However if he is unable to help you I would like to offer my services. I have more than 10 years of professional level experience programming with Common Lisp. Please see my website at http://asmith.id.au/services.html for more information if you are interested.

Cheers,
Andrew Smith

http://asmith.id.au
http://wixml.net

 

 
  [ # 13 ]

Dear David Newyear,

cc: Michele McNeal

Have you reached out to Gil Sideman of SitePal yet?

★ This seems like an important issue to eliminate.

Are popup blockers on? Or Javascript disabled?

What is the exact input that triggers the glitch?

Has it been tested on IE 7,8, Windows XP,Vista,7, Firefox, Linux?

 

 
  [ # 14 ]

Thank you for all of your replies. We’ve been working with Dr. Wallace and I think we’re very close to solving this problem. We wrote a test aiml file:

<?xml version="1.0" encoding="UTF-8"?>
<aiml version="1.0">

<
category>
<
pattern>TEST DO YOU HAVE THE TITLE TEST</pattern>
<
template>Let's see what's in the catalog!
<
think><set name="catalog">search</set></think>
</
template>
</
category>

</
aiml>

then added the following template to our input.html file:


<
template>
<
condition name="catalog" value="search">
[removed]var myWindow =window.open('https://catalog.mentorpl.org/search/?searchtype=t&amp;SORT=D&amp;searcharg=<star/>&amp;searchscope=12');[removed]
</condition>
<
set name="catalog"><font color="B0D0E6">nosearch</font></set>
</
template

This has gotten us very close - the text to speech is fixed and a new window opens with our catalog. The only problem is that the * value is not getting passed to our catalog.

Any ideas?

BTW - Another library may be joining us soon and implementing a bot of their own. This idea is catching on.

 

 
  [ # 15 ]

Dear David Newyear,

I have plenty of ideas on how to fix it, but since it is a commercial product, usually the company is the safest bet to resolve commercial product issues for their customers.
So, I am not requesting, and I have no need to know, any information regarding your system, or any system of the company.  In particular, I have confidence in the excellent company and professionals you chose to work with. 

This my opinion and general discussion of my personal 3 tier system for an Artificial Intelligence engine which may share many simularities with commercial systems:

 

[ul]
[li]XML gets loaded into the Database Tier.[/li]
[li]The client side is the Presentation Tier[/li]
[li]The server side is the Middleware Tier[/li]
[/ul]

 

Javascript can simply be on the Presentation Tier as static HTML, or Javascript can be dynamically generated HTML by the Middleware Tier and delivered to the Presentation Tier on client side.  So, by tracing through the Tiers an alternative to optimize the code may be found.  Such as a small custom patch to move some static code from the Middle Tier to the Presentation Tier, then patch the Middle Tier to just dynamically update key parts, which is essentially a code template.

There are sometimes static sections of the Javascript that are dynamically generated, because it is just easier to dynamically generate a block of code, rather than take the time to figure out how to optimize key parts of the code block.  Not to put down the ‘keeping it simple’ coding approach… It is a good way to code when it works. It is often easier to read and less expensive to maintain.  Sometimes, however,  one size just does not fit all.


With that said, please know that you have friends here who want to help and
see you succeed.  You bring up a topic that I may enjoy most. Text To Speech and rendering voice phonemes video is my favorite, though I know making the bot smart is important too.  Here is a sample video of my custom 3 Tier system with Text To Speech, 3D Rendering:

http://www.newsAI.com/TV.php  Click the NewsAI TV Channel button to return here.

My personal 3 tier system for an Artificial Intelligence engine is not commercial and is not optimized for the web.  So it would be quite expensive to run it over the web interactively.  The good news is I have the luxary of running it unlimited bandwidth, on my localhost webserver linux laptop for entertainment purposes.  That is why I have a lot of respect for the commercial products that do this professionally over the web with low bandwidth at a very low cost, compared to the high cost of a dedicated server or a virtual private server. 

 

 

 

 

 1 2 > 
1 of 2
 
  login or register to react