Visual Programming and Software Engineering Group


How to use the WWW-based tool to create "smart documents"

Disclaimer: this tool is at an early prototype stage and is mostly meant to be a proof of concept. Your comments are welcome.

The tool we are demonstrating is meant to be used by WWW document authors who want to include, in their documents, input fields that the document reader (the user) can fill in, and that will lead to different other WWW documents based on the (free text) input that the user has given. This tool is heavily based on forms. The author as well as the reader of such "smart documents" will therefore need a form-capable WWW browser. In spite of this, the authors do not need to know how to put forms in their documents, as our tool will do it automatically for them.

The author can specify criteria that will be matched against the user input to classify this input in different categories. All the possible input that match a given category will trigger the same behavior, i.e. will lead to the same document. There is no limit as to the number of different categories.

The syntax of the criteria is rather simple and allows the author to specify patterns to match against the user answer. The mechanism is based on the detection of (possibly multiple) keywords within a sentence, with the possibility to provide lists of synonyms and to specify only partial words, and even to specify words that should not be found in the sentence.

Here are the various steps involved in the creation and use of such smart documents. It does not involve running a special HTTP server, nor downloading a special program. Everything can be done via WWW, with a regular browser supporting forms.

  1. The author first prepares the document that will contain the user input field, putting a placeholder at the place where the input field will later be automatically substituted. This document should be accessible on some HTTP server to which the author has access. An example of such a document is available, in which the placeholder is the word AnswerForm. This placeholder could be just any sequence of characters.

  2. The author prepares the file containing the various criteria and the association list relating each criterion with the URL of a document that should be displayed when the criterion matches the user's input.

    The format of the file is the following:

  3. The author invokes the form in http://cui.unige.ch/eao/www/FreeText/DeveloperForm2, and fills in the details about his/her document:

    There is an example form that has been pre-filled to show how the form should be filled. We suggest that you open another browser window on this example form to try it while you keep on reading the present document (with NCSA Mosaic, use the middle mouse button to follow a link to a document that will appear in a new window. With Netscape 1, you will have to select the File/New_Window menu item, then use the Go/Info_on_how_to...smart_documents to see the present document in a second window, then follow the link to the example form).

  4. When the author presses the Get me the final document button in the form, the content is sent to a cgi-bin script named developer2.

  5. The developer2 cgi-bin script first checks that the document containing the placeholder can be retrieved over the net, then checks that the placeholder can be found in it. At each of these steps, an appropriate error message is sent back if a problem occurs.

  6. The developer2 cgi-bin script then replaces the first occurence of the placeholder in the original document with the HTML code for a form that contains a text-input field, a "Continue" button, and hidden fields containing the criteria found in the criteria file (also retrieved accross the net). For the moment, no check is made to ensure that the syntax of the criteria is correct (this is a prototype).

    Try clicking on the Get me the final document button in the second window and see what you get.

  7. The resulting document is then sent to the author as a reply to the query.

  8. The author can try this resulting document right away to see if it behaves as desired. If not, the author can update the criteria file and go back to the form (using the Back button of the WWW browser) to get a new version of the resulting document.

    Try entering something like "I use my hand" or "I use an instrument", or even "I guess a thermometer would do the trick" and see what reply you get (don't forget to type the Return key or to click on the "Continue" button, and watch the document title of the reply, among other things). Go back to the previous document and try to enter another answer. Watch how you get each time a different reply (assuming that you type a different answer each time).

  9. When the author is satisfied with the result, he/she can save the document (in HTML form, of course) in a file that is accessible from his/her HTTP server to make it available to other users.

  10. When a user reads this generated document and fills in the input field, the content is sent to another cgi-bin script, named Analysis.

    (You saw what happened when you tried typing in various answers)

  11. The Analysis cgi-bin script invokes our pattern matching program which will tell which criterion was satisfied. If the pattern matching works properly, the cgi-bin script will issue a "Location: ..." reply with the URL of the document corresponding to the category of the user input. This will cause the WWW browser to fetch that document automatically. If, for some reason, the pattern matching program chokes on one of the criteria provided by the author, the cgi-bin script will warn the user, asking him/her to tell the author about the problem.

Syntax of the criteria

The syntax is described in a separate document.

CGI-bin scripts used in this demo

The following scripts are written in Tcl. You can install the developer's form handling script on your own WWW server, if you want to have better response time. But you are welcome to use our server too. As for the Answer analysis script, it wouldn't help to install it on your server if you don't install at the same time the Pascal program that does the pattern matching (see below).

Pattern-matching Pascal program

The pattern matching is done by a program written in Pascal, that works as a filter: it gets from "standard input" a sentence followed by an arbitrary number of patterns, and returns in "standard output" the number of the pattern that matched (1 if first pattern matched, ..., n if n-th pattern matched, 0 if no match was found). You can either use the on-line version that we put on the web, and that can be used from anywhere on the Internet even if the documents that use it are on other servers, or, if you belong to an academic institution and want it for non-profit use, you can get in touch with us to get the sources (~300 lines of code).

Our next step will probably be to translate the pattern matching Pascal program into a Java applet that could run directly in a (Java-enabled) browser.

Related work

As far as we can tell, previous work focusing on providing educators with tools to embed answer analysis in WWW documents has been limited to multiple choice questions, true/false questions, single numeric questions, and single algebraic expression questions. We have found at least the following:

Additional reading

The following papers describe some aspects of the system:
If you would like to comment on or give us some suggestions about the information we're providing, you can do so by following this link .

Bertrand Ibrahim - VP-SE

Last modification: April 12, 2000.

Site Hosting: Bronco