QuickStart_Logo.gif (38003 bytes)

The quick start guide to using Chomp.

 

Chomp is the command line interface for the Chompy project. This quick start guide will introduce the Chomp commands and brief explanation of how to use Chomp. If you are going to follow this guide then you should download and install the Chompy package.

 

Contents

Starting Chomp

Loading a world

Adding rules to a world

Deleting rules

Saving the world!

Querying the world

 

Starting Chomp

Depending on the installation procedure that you followed, if you used the default directory structure as described on the installation page then you will start Chomp with either:

	"c:\Program files\JavaSoft\JRE\1.2\bin\java.exe" -cp c:\chompy Chomp

or

	java Chomp


C:\chompy>java Chomp
Welcome to Chomp :)
===================
Chomp is the command line interface for Chompy.
For a list of commands type: help
:->

Contents

 

Loading a world

In order to run a query in Chomp, you need to have a set of rules to work with. These rules are referred to as the current world, since they describe a closed world set of rewrite rules (see the main guide for further details). The Chompy package contains a sample world called "small.wld". To add a world to Chomp you use the ADD command with one argument:

	ADD <filename>

Hence to add the "small.wld" world you would use

	ADD small.wld

Welcome to Chomp :)
===================
Chomp is the command line interface for Chompy.
For a list of commands type: help
:->ADD small.wld
Rules parsed: 8 OK
Rules added: 8 OK
:->

The list of rule that have been loaded into Chomp can then be viewed using the LIST command:

Welcome to Chomp :)
===================
Chomp is the command line interface for Chompy.
For a list of commands type: help
:->ADD small.wld
Rules parsed: 8 OK
Rules added: 8 OK
:->LIST
0 _S = _NP
1 _S = _NP + _VP
2 _NP = _ART + _NOUN
3 _NP = _NOUN
4 _VP = _VERB
5 _ART = THE
6 _NOUN = DOG
7 _VERB = RAN
:->

Contents

 

Adding rules to a world

There are two ways to add rules to the world. The first is to make a world text file, similar to "small.wld" used above, with one rule or file name per line, or by adding rules directly at the command line with the ADD command. Rules are composed of 'atoms' and 'operators'. An atom is a string of alphanumeric or underscore '_' characters with no spaces e.g.:

the
cat
Hello
SoftBlue
D115WAR

are all valid atoms. While there are two operators, the equivalence operator '=' and the addition operator '+'. They are used to format rules with one atom as the left hand argument and one or more atoms joined with the addition operator forming the right hand argument(s). For example:

TheLeftHandArgument = RightHandArgument1 + RightHandArgument2

Note that all inputs are converted to upper case by Chomp so the above rule will be listed as:

THELEFTHANDARGUMENT = RIGHTHANDARGUMENT1 + RIGHTHANDARGUMENT2

Example:

Welcome to Chomp :)
===================
Chomp is the command line interface for Chompy.
For a list of commands type: help
:->ADD TheLeftHandArgument = RightHandArgument1 + RightHandArgument2
Rules parsed: 1 OK
Rules added: 1 OK
:->LIST
0 THELEFTHANDARGUMENT = RIGHTHANDARGUMENT1 + RIGHTHANDARGUMENT2
:->

As we saw above, world files may be added directly into Chomp with the ADD command. They can also be added to world text files as the only argument on a line. For example in the following file the contents of "Kitchen.wld" is added at the fourth line of "Home.wld":

File "Home.wld"

	_S = _NP + _VP
	_NP = _ART + _NOUN
	_VP = _VERB
	Kitchen.wld
	_ART = the
	_VERB = drink

File "Kitchen.wld"

	_NOUN = cup
	_NOUN = milk
	_NOUN = bread

The when the file "Home.wld" is added to Chompy the rules list would show:

Welcome to Chomp :)
===================
Chomp is the command line interface for Chompy.
For a list of commands type: help
:->ADD Home.wld
Rules parsed: 8 OK
Rules added: 8 OK
:->LIST
0 _S = _NP + _VP
1 _NP = _ART + _NOUN
2 _VP = _VERB
3 _NOUN = CUP
4 _NOUN = MILK
5 _NOUN = BREAD
6 _ART = THE
7 _VERB = DRINK
:->

Contents

 

Deleting rules

Rules may simply be removed from the world with the DELETE command. DELETE on its own will remove all the rule from the current world:

:->DELETE
Are you sure you would like to delete all the rules [Y/N]?
:-o Y
All deleted!
:->

Individual rules may also be delete by specifying a rule number after the DELETE command. Note that the rule begin with rule number 0 (zero):

:->list
0 _S = _NP
1 _S = _NP + _VP
2 _NP = ART + NOUN
3 _NP = _NOUN
4 _VP = _VERB
5 _ART = THE
6 _NOUN = DOG
7 _VERB = RAN
:->DELETE 2
Are you sure you would like to delete rule 2 [Y/N]?
:-o Y
Rule 2 deleted!
:->LIST
0 _S = _NP
1 _S = _NP + _VP
2 _NP = _NOUN
3 _VP = _VERB
4 _ART = THE
5 _NOUN = DOG
6 +VERB = RAN
:->

Contents

Saving the world!

Each world may be saved simply with the SAVE command followed by a valid file name:

:->SAVE new.wld
'NEW.WLD' saved!
:->

If a file name has already been specified with a previous SAVE command, then SAVE may be used without a file name argument, in order to save the world with the current file name:

:->SAVE
'NEW.WLD' saved!
:->

Contents

Querying the world

So now we have the rules that we want in the world, it is time to query the world. As with the present version (1.0) there is only one query that can be made of the Chompy world, however this is an important query. The "isa" query tests if a given string (or sentence) is of the form of a simpler string (or sentence). For example consider the "small.wld" world:

_S = _NP
_S = _NP + _VP
_NP = _ART + _NOUN
_NP = _NOUN
_VP = _VERB
_ART = the
_NOUN = dog
_VERB = ran

We may want to ask the question is "the dog ran" a grammatically valid sentence "S", based on these rules. This query is run in Chompy with the IS "<source string>" A "<target string>":

:->IS "the dog ran" A "S"
Yes! The string "THE DOG RAN" is a form of "S".
This query took: 0.01 seconds to complete.
:->

the result of this query is true, while the query is "the ran dog" a grammatically valid sentence "S", based on these rules:
:->IS "the ran dog" A "_S"
No! The string "THE RAN DOG" is not a form of "_S".
This query took: 0.05 seconds to complete.
:->

is false, even though all the atoms are valid within the world, the grammatical structure is not. This is how Chompy evaluates the query, by repeatedly trying to re-write the source string to match the target string:

Source String Rule used
the dog ran none
_ART dog ran _ART = the
_ART _NOUN ran _NOUN = dog
_ART _NOUN _VERB _VERB = ran
_NP _VERB _NP = _ART + _NOUN
_NP _VP _VERB = _VP
_S _S = _NP + _VP

The result of the query in Chomp also state how long it took to query the world, and you can see that the grammatical sentence was quicker to resolve than the non-grammatical one, using the same valid atoms.

For more details about using Chomp and Chompy see the guide or the ChompHelp.txt file that comes in the Chompy package..

Contents

Home01.gif (5373 bytes)Home01.gif (5373 bytes)Home01.gif (5373 bytes)Guide01.gif (6407 bytes)

Thanks go out to Eyepoppers for there fine wallpapers.

line.gif (12072 bytes)

Chompy is Copyright 1998 (Neil Blue) SoftBlue. All rights reserved.