Home |
Travaux STAF |
STAF14 - Report for exercise 5 - Regular expressions |
STAF-E |
R E P O R T
bot
Conception
Once more time I tortured myself to find a good idea, this time for
implementation with regular expressions in Javascript :) One of my ideas
that seemed really nice in the beginning and I started to implement it,
was to make a First Aider on-line to give quickly guides to someone that he
or someone close to is in need of immediate medical care after an accident
or a sudden illness.
When I started to implement the idea, there came out all the problems...
And it was then, I realised that however clever I was intending to make it,
it will never be trustworthy (for real use, of course) and it was impossible
for me that I'm not even a doctor :) to cover all the cases.
So, I rejected the idea (and also the part I implemented) searching for new
ideas.
The idea, I came out this time, is called "XML bot" and is a robot called
"Pythia" (you know, the greek Pyhtia from Delphi) that tries
to answer to all the potential questions about XML. The pattern I had in mind,
while I was searching for ideas, was to find a theme that would be really
narrow in order the questions and the possible answers to be as more specific
as posible. So, when I'm saying that "Pythia" answers to questions about XML,
I'm refering to questions of general interest like "What is it?",
"What are the advantages?" or "Who launched it?" and so on. All the questions
we are trying to answer reading an article about something new, or we're
asking a colleague to explain to us.
Eventhough I was really tired after all the work I have done fot this diploma
so far and with a ticket to Greece for the last 10 days of this period
(starting from tomorrow!!!) I made an effort to make "Pythia":
- creative: by creating new web pages based on the needs of
the user including links that make the information
more dynamic.
- useful: Deals with a subject that is very much in talk these
days.
- ergonomic: I changed the interface by putting frames, and having
all the dialog in a page, with links that open in a
new window, in order to see them in parallel with
talking to "Pythia".
Also, the command "help"
that I provide to the user, make him understand
what I can answer and in what way
(in a way, I made the same with the button about
bot's memory but in a more user-friendly way,
I hope :)
By putting an
automatic scrolling on the chat frame, the user
doesn't have to worry by moving the scrollbar.
- with an improved script that works : at least that's what I
hope after all the tests I have done :)
Eventhough
the changes on the script are not huge, I think
that they give a more structured result.
TOP
The scenario
Introduction page:
At the beginning, the user faces a "welcome" page with a short description
about Pythia and it's capabilities. I put emphasis on this unique
feature of Pythia that creates new web pages on demand. From this page with
the aid of a button called "Ask Pythia" the user can enter to the chat
interface...
Input frame:
This is the frame where the user can ask questions to Pythia writing into a
text field of a form having the casualties like Enter and Reset buttons.
I kept the initially designed buttons "Bot's memory" and "Debugging" that
are helpful both to me while I was testing my script and of course for the
user. I just changed the esthetics like colors and position and that was all.
I added the link "Exit" to help the navigation, and it happens the
same thing when the user says "Goodbye" or "Bye" to Pythia.
Here I'm proposing also to the user to write "help" whenever he is out of
ideas of what to ask.
Output frame:
It is the frame where the answers and the questions posed are printed in a
form of a dialog distinguishing questions from answers with different colors.
I included an automatic scroll of this frame in order to see always the last
answer on the frame without having to use the scrollbar.
Bot's memory:
I didn't make any changes to this part, due to lack of time and because it
seemed quite good the way it is already :)
The things that deserve to be mentioned specificaly:
- noframe notification: I included noframe message to
warn users with old browser versions (is out there anyone left?).
- frames' interface: I changed the interface to have frames,
in order to have all the dialog saved in a frame. Like that, it would be
really easy to print it later and keep all the information together.
(I inspired by the environment of a CHAT, on the BITNET of IBM I used
during my graduate studies -1987!!!- and is a tribute to all the friends
I made there :)
- include links: Whenever I judge necessary I provide useful
links that can be explored on a new window.
- Help command: to help the user when he's out of ideas of what
to ask, by proposing to him questions and themes. Like that, I give also to
the user the opportunity to understand what kind of questions my bot
understands.
- Exit: for an easy navigation back to the welcome page.
- Goodbye: When the user says "goodbye" he exits immediately the
bot and goes back to the welcome page.
TOP
Technical details - problems
Regular expressions are quite easy to understand, and to my case, I wasn't
in need of very complicated ones. Eventhough, for a different subject
it would be really challenging to find the best fitted pattern.
I knew from the beginning that it was impossible to do something perfect,
so I didn't expect too much. The result of my "Pythia" seems quite close
to my expectations. It keeps a normal conversation as long as the user
uses "help" from time to time.
It took me more time to write possible answers to the patterns in the end
than writing the patterns themselves :) But that is what makes it look
more natural so I worked quite on it.
I would like to apologize for the possible mistakes about XML, but is a
subject that I'm just started to study, so you can imagine it's not my
strongest point for the moment :) But it was a good opportunity to combine
both.
Having a prior experience with Javascript, things weren't difficult
and I didn't have any problems worth mentioned here.
TOP
References - Bibliography - Sites
- Les expressions régulières,
- The chatter-bot by D.Schneider & C.Roiron,
- String Matching and Replacing in Javascript 1.2 by Angus Davis,
- "Guide to building Intelligent Websites with Javascript" by Nigel Ford, ISBN 0-471-24274-8
- "Javascript, The definitive guide" by D.Flanagan, O'Reily, ISBN 1-56592-234-4
- "XML et DOM" by D.Schneider,
- "XML, L'amorce d'une révolution pour les systèmes d'information du futur", Flash Informatique, EPFL,
- "Beyond HTML: DOM and DOMer" by Michael Floyd.
TOP