CDC Community

🔹 Historical Conservation 🔹

User Tools

Site Tools


tutor:student_non-numerical_parameters

Student Specification of Non-Numerical Parameters

Now that we have seen how to let the student specify a number, let's see how to ask the student to tell us his or her name or nickname to permit us to communicate by name:

unit meet at 1215 write Hello, my name is Sam Connor. What's your name? arrow 1620 long 8 $$ limit to 8 characters storea name $$ define "name" earlier ok write Pleased to meet you, ⊀a,name⊁!

The -storea- command is a judging command which will store alphabetic information as distinguished from numeric information. The Qa,name> is the embedded form of the statement “showa name” which will display alphabetic information. This unit will feed back to you any name you give it. Notice that you can't enter a name of more than 8 characters because of the -long- command. TUTOR stores a capital letter as a “shift” character plus the lower-case letter, so if capitalized, the name must be shorter because a capital letter counts as two characters. (Insert a “force long” statement anywhere before the -storea- if you would like judging to start upon hitting the -long- limit, without having to press NEXT.)

A statement of the form “storea name,3” will store just the first three characters of the student's response. You can get and keep a character count of the length of the student's name, including “shift” characters, by referring to the system variable “jcount”, which is a count of the number of characters in the copy of the student response used for judging - hence the “j”. With these facts in mind, change the -storea- to:

storea name,(namlng⇐jcount)

This will store the whole response and save the length. Be sure to define both “name” and “naming”, but do not define “jcount” or you will override TUTOR's definition of its function. Also, to show the precise number of characters, change the embedded -showa- to:

⊀a,name,namlng⊁

The reason for saving the present value of “jcount” in “naming” is that “jcount” will change at each -arrow- in the lesson, whereas throughout the lesson you will repeatedly use “showa name,namlng” or <a, name,namlngl> to call the student by name. So, you want “naming” to keep the name length. Incidentally, a -showa- with only a single argument (such as “showa name”) will show ten characters, which is the number of characters (including shift characters) that will fit in one of your variables.

It is possible to store alphabetic information which is longer than ten characters. Change the “long 8” to “long 20”. Suppose you've defined name In this case, you must make sure that you are not using v25, and change your defines if necessary. The 20-character name will need both v24 and v25 since each variable can hold only ten characters. With these changes it is possible to enter a long name (e.g., Benjamin Franklin, which is 19 characters counting shift characters).

Difference Between Numeric and Alphabetic Information

When we were studying the desk calculator unit, we defined a variable “bob-=v30” for the student. Suppose the student responds with the word “bob”. If we use a numeric -store-, we will get the number presently contained in v30, which might be 529.3. If we use an alphabetic -storea-, we will get the string of characters “bob” which is simply a name and nothing more. Perhaps the distinction is most easily seen with an example, which you should write and try out at a PLATO terminal:

define student bob=v1 define ours,student $$ include "student" set of defines name=v2,num=v3 unit test calc bob⇐π $$ π means 3.14159 arrow 1815 store num storey name ok write num=⊀s,num⊁ name=⊀a,name,jcount⊁

Consider various responses. For example, “2bob” should give a numeric 2π (6.2832) and an alphabetic “2bob”. Most often, we speak of “alphanumeric” information (letters and numbers) in the latter case. The response “3-4/5” yields a numeric 2.2 and an alphanumeric “3-4/5”.

In other words, a storea/showa combination feeds back exactly the alphanumeric text entered by the student. However, a -store- involves a numerical evaluation of the student's response, and a later -showconverts this numerical result into appropriate characters to display on the screen (so that you can read the result). You might interchange the “num” and “name” arguments on the -store- and -storea- commands to see the unusual things that happen if you pair -store- with -showa- (instead of -show-) or if you pair -storea- with -show- (instead of -showa-).

To sum up, if you accept numeric information with a -store-, display it with a -show-. If you accept alphanumeric information with a -storea-, display it with a -showa-.

More On -answer- and -wrong- (Including -list- and -specs-)

There are some additional features of -answer- (and -wrong-) which should be pointed out. First, -answer- will not only handle word or sentence responses but will also handle numbers:

answer 7 women <and> 5 men

This -answer- will be matched by a student response of the form “14/2 women and 3+2 men” because simple expressions such as 14/2 or 3+2 are evaluated by the -answer- command. Currently, the -answer- command will not handle very complicated numerical expressions.

(Later we will discuss the -ansv- and -wrongv- commands which handle expressions as complicated as those handled by -store- but without the sentence capabilities of -answer- arid -wrong-. There are also -ansu- and -wrongu- commands which are similar to -ansv- and -wrongvbut treat scientific units on a dimensional basis.)

If the student says “37 women and 5 men,” the incorrect number 37 will have xx under it, whereas the response “6.5 women and 5 men” will have the 6.5 underlined since it is nearly correct (similar to a misspelling of a word). Normally -answer- and -wrong- consider numbers off by less than 10% to be “misspelled.” You can alter these specifications by preceding the list of -answer- and -wrong- commands with a -specscommand:

unit trial arrow 1815 specs toler,nodiff answer 7 women <and> 5 men

The -specs- command is a judging command which affects the operation of other judging commands which follow it. Here it has been used to specify that a “tolerance” of 1% is permitted and that “no difference will be allowed for underlining” (normally 10%). Having specified both “toler” and “nodiff,” any expressions within 1% of 7 and 5 will be accepted, but expressions with larger discrepancies will not be underlined.

Note carefully that since -specs- is a judging command, it terminates the processing of regular commands. Among other things, this means that a -long- command must precede the -specs-, not follow it. If -long- comes after -specs-, TUTOR could not prevent the student from entering a longer response (since it could not see the -long- command before it paused for the student's response).

Here are some other useful applications of -specs-:

specs okcap,okspell answer the antidisestablishmentarianism doctrine

This allows the student to capitalize words, and specifies that misspellings are to be considered ok. Note that if the -answer- tag contains capitalized words, the student must also capitalize those words. The “okeap” makes capitalization optional only for those words you have not capitalized. You can use -specs- to ignore extra words:

specs okextra answer Washington

This states that it is ok to have extra words, so that “It was George Washington” will be an acceptable response. The following is another example of -specs- capabilities:

specs noorder answer apples pears and peaches

This specifies that no particular word order is required. Note the absence of commas in the -answer- tag. (Such punctuation marks are not allowed there, but all punctuation marks are ignored in the student's response, so he or she may use commas). Also, note that “answer apples, pears and peaches” would represent two synonymous answers, and the student could respond either with “apples” or with “pears and peaches”. There exists a much less powerful -exact- command (as well as other techniques) for judging particular punctuation when that is necessary. For example, it is possible to use the -change- command to redefine the comma to be a “word” rather than a punctuation mark. In that case, some otherwise unused character must be defined to take the place of the comma in specifying synonyms.

specs nookno ok

Here we specify that no “ok” or “no” be displayed beside the student's response, contrary to the normal situation. (As an alternative, the -okword- and -noword- commands can be used to change the words TUTOR uses from “ok” and “no” to something else.) (For other -specs- capabilities see reference material described in Appendix A.) Another important feature of -specs- (in addition to its use in specifying various options) is that it marks a place to return to after judging. Consider the following unit. You do not define the system variable “spell”.

unit presi at 1212 write Name one of the first three U.S. presidents. arrow 1513 specs bumpshift $$ delete shift codes at 2508 writec spell,No misspellings!, Underlining indicates a misspelled word. answer washington write Good old George. answer adams answer jefferson

Suppose the student types “WASHINGTON”. TUTOR starts judging just after the -arrow- and encounters -specs-, a judging command. The tag (“bumpshift”) tells TUTOR to change the response to “washington” for judging purposes. (Incidentally, this operation changes “jcount”, the character count of the judging copy of the student's response, from 20 to 10 because the “shift” characters are knocked out.) Moreover, TUTOR makes a note that it encountered a -specs- command as the fourth command in unit “presi”, and this marker will be used in a moment. TUTOR skips the following -at- and -writec- because regular commands are skipped in the judging state.

Next, TUTOR encounters “answer washington” which matches the student's (altered) response, and this terminates judging. The succeeding regular commands are processed as usual. In this case, there is only a “write Good old George” before we run into another judging command (“answer adams”) which stops the processing.

Actually, processing has not completely stopped. It is at this point that TUTOR asks one last question: “Did I pass a -specs- command in processing this response?” The answer is yes (at the fourth command in unit “presi”). TUTOR now processes any regular commands following that -specs- marker. In this case, TUTOR does an “at 2508” and a -writec- before finally being stopped (really stopped this time) by the first -answer- command.

The -writec- refers to the system variable “spell” which is true (-1) if the spelling is correct, and false (0) if a misspelling has been detected. The variable “spell” is -1 if there are no underlined words, but there may be X'ed words (words that are completely different).

The usefulness of the marker property of -specs- is that you can specify a central place to put messages and calculations, which should be done no matter which judging command is matched. We will see additional applications of this useful feature of -specs-. Notice that a later -specs- command will override an earlier -specs- marker in a manner analogous to the way a later -help- command overrides an earlier setting of the “help” marker. Note, too, that if no regular commands follow the -specs-, TUTOR finds nothing to do when it comes there after being nearly stopped as described above. This was the situation in our previous examples such as:

specs nookno ok

In this example, there are no regular commands between the -specs- and the -ok-.

Let us return for a moment to the -answer- command. We had examples involving synonyms such as (right,rt) or (Va,Virginia). A convenient way to specify synonym lists which occur frequently in a lesson is to define a -list-:

list affirm,yes,ok,yep,yeah,sure,certainly

Here “affirm” is the title of a list of synonyms (“affirm” is not itself a member of that list). With this definition, which should be placed at the very beginning of your lesson along with your -define- statement, you can write:

answer ((affirm)) wrong maybe ((affirm))

These are equivalent to:

answer (yes,ok,yep,yeah,sure,certainly) wrong maybe (yes,ok,yep,yeah,sure,certainly)

Note that “answer we affirm” does not imply this list of synonyms, just as a single important word by itself does not refer to a list. You can use the list equally well to specify optional words, as in:

answer <<affirm>> it is

Here «affirm» is equivalent to <yes,ok,yep,yeah,sure,certainly>. Note that <affirm> merely refers to the single word “affirm”. Double marks are needed to refer to the list whose title is “affirm”. You can combine references to synonym lists with individual words. For example:

wrong usually (definite, (affirm)) answer often <definite, <affirm>>

The following list might also be particularly useful:

list negate,no,nope,not,never,huhuh

This covers the main capabilities of the -answer- and -wrongcommands and their associated -list- definitions. The -specs- command may be used to modify how -answer- works and also serves as a useful marker. The marker function of -specs- is not limited to -answer- but holds for any judging commands which follow it, including -ok- and -no-

The -answer- (or -wrong-) command can nicely handle responses which involve a relatively small vocabulary of words. It is, therefore, adequate when the context limits the diversity of student responses (such as foreign language translation drills where there are only a few permissible translations of the sentence and each such sentence contains a rather small number of allowable words). The detailed markup of the response provides the student with useful feedback in such a drill.

The -answer- command is not well-suited to a more free dialog with the student where the context is broader and where the vocabulary used by the student may encompass hundreds of words. In the next section we discuss the -concept- command which can cope with more complexity.

Building Dialogs With -concept- and -vocabs-

tutor/student_non-numerical_parameters.txt · Last modified: 2022/08/25 20:35 by 127.0.0.1