Putting conditions to work

First, a French word list

Assume that you have built a small French dictionary using a very simple list structure. The complete dictionary - the complete list - could be called "french, and an entry for any particular word, say fromage, might be set up as a sub-list including, amongst other things, still lower level lists to handle different attributes of the word (including an English translation, if you wish):

[ . . . .
[ [orthography fromage] [category noun] [gender masculine] [means cheese]]
. . . . ]

Let us in addition suppose that you have defined a procedure called entry which takes as input the orthographic form of some word (say "fromage) and outputs the complete entry for the word which is found in the dictionary. For now you can ignore the real details of this procedure quite easily. It is a simple matter to define a fake procedure which will produce the right kind of output - even if not by the right means - so that we can get on with other things. For instance, a crude but effective tactic would be to define entry like this:

to entry :word 
op [[orthography fromage][category noun][gender masculine][means cheese]] 
end 

This procedure will output [[orthography fromage] [category noun] [gender masculine] [means cheese]] no matter what input it receives. If you say entry "cheval (or even entry "horse) you still get [[orthography fromage] [category noun] [gender masculine] [means cheese]]. But, of course, you can quickly edit the procedure definition so that entry outputs some other list when you wish. (This method of dodging a problem to focus on another is quite useful. So don't look down on it.)

Choosing the correct definite article

Now to the point. The French word corresponding (more or less) to English the - the definite article - appears in a number of different forms. If the noun it is constructed with is plural then the form is les. So the cheeses comes out as les fromages. If the noun is singular, then the form equivalent to the is either l' or le or la. And what we find in French is that the choice between the three singular articles depends on two different kinds of factors. You use l' if the noun begins with a vowel. This is a choice based on the form of the word. If it does not begin with a vowel, then you use le when the gender is masculine and la when the gender is feminine. This is a choice based on the grammatical (gender) class of the word.

Our eventual goal, in these circumstances, is to define a procedure (an operation) called article which will output the appropriate form of the French definite article when given a French word as input. Since nothing of consequence is excluded by ignoring the plural les, however, we can reasonably simplify the problem at first and focus exclusively on the three singular forms. Our immediate problem, then, is: How do you set up a definition for the operation article so that article "fromage outputs "le, while article "assiette outputs "l' and article "banane outputs "la?

The header

Well, the header is easy enough. You know that the first line of the definition will need to establish an input variable name if we are going to provide different words on different occasions as inputs to the procedure. "Current.word is as good a name as any for that purpose, so let us suppose that our first line is simply:

to article :current.word

Constructing tests with member?

In the body of the definition we will clearly need some ifs which use tests of different types. But although we need one test to check the form of the input word and another to test its dictionary entry - to establish the gender class - both kinds of test can, in fact, be set up by taking advantage of the primitive predicate member?

Member? takes two inputs. It outputs "true if its first input is a member (at the first level of analysis) of its second input. It follows that

member? "a [a e i o u]
will output "true

and

member? [gender feminine] [[orthography souris][gender feminine][means mouse]]
will output "true

In order to check if :current.word begins with a vowel (and then, if so, to output "l'), we can, therefore, use the following instruction:

if member? first :current.word [a e i o u] [op "l']

To paraphrase in English: If the first element of the thing called "current.word is a member of the list [a e i o u] then output"l'

In order to check if :current.word belongs to the feminine gender (and if so to output "la), we need to see if the sub-list [gender feminine] is included in its dictionary entry. Given our definition of entry, the expression entry :current.word will retrieve the dictionary entry (even if for the moment always the same and not always the right one). Entry : current.word is therefore the appropriate expression to use for the second input to member? The first input must be the sub-list we are attempting to find - [gender feminine]. The whole instruction reads as:

if member [gender feminine] entry :current.word [op "la]

In English: If the list [gender feminine] is a member of the entry for the thing called "current.word then output "la.

Ordering the conditional instructions

So far we have considered separately how to express two different conditions involved in the selection of the definite article. We have said nothing about the order in which the conditional instructions must appear in the definition. No doubt, you have supposed that they will appear in the order in which we have considered them.

if member? first :current.word [a e i o u] [op "l']
if member [gender feminine] entry :current.word [op "la]

As it happens, this is indeed the appropriate order when the tests are expressed as they are. But it is important to realise that the order in which the conditional instructions appear has significant consequences. The second test (for gender) can only be expressed as succinctly as it is here when the instructions are in this order. If you know a little French, you will know that not all French words of feminine gender are constructed with the article la. The second test of the two only works correctly because it relies on the first test having filtered off (having dealt with) all vowel-initial words, no matter what their gender. If the second instructions came first, then article "assiete (since assiete is feminine) would output "la. This is not French! A partial flow diagram will perhaps help to make the point clear. (Remember that an instruction starting with op - like op "l' -shuts down its parent procedure so that no processing of subsequent instructions takes place.)

The elsewhere case

If you are still thinking at this point that, since there are three forms of the singular article in French, a third condition will be needed to cope with the situation in which the gender of the noun is masculine, then stop and think again. As long as the three tests cover every possible case, any word which fails on any two of the tests must inevitably pass the third, and there is consequently no need to check explicitly that the condition is met. With an ordered series of tests, the last case is simply the elsewhere case. Whatever needs doing is done to whatever is left. In other words the last line of article can be simply op "le. Any words needing "la or "l' will have been dealt with by a previous instruction.



Ron Brasington
Department of Linguistic Science
The University of Reading
Reading
UK

E-mail: ron.brasington@rdg.ac.uk